Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Engineering 2 nd Semester Dr. Rabie A. Ramadan 3.

Similar presentations


Presentation on theme: "Computer Engineering 2 nd Semester Dr. Rabie A. Ramadan 3."— Presentation transcript:

1 Computer Engineering 2 nd Semester Dr. Rabie A. Ramadan http://rabieramadan.org/classes/2011/prog/ 3

2 2 Revision How many types of errors can occur in C++? Syntax and logical C++ is an object oriented language (true/false)? It is not required in all times to write a prototype for a function (true/false)? To use a class, a variable from that class has to be created (true/false)?

3 3 Revision To use a structure, you must create an object from it (true/false)? Write a “while” loop to execute the following statement for 101 times: cout<<“ hello”; Write a function to : Compute the number of elements with value “5” in an array

4 4 Revision Write a class and its functions to: Compute the area of a rectangle Set its width Set its length Return width Return length Where, Area = length X width

5 5 Revision Writing a function requires three steps which are …….., ……….,…….. Differentiate between “private” and “public” pacifiers? Given a class named “Circle”, write a single line of code to create array of 10 objects of this class?

6 6 Revision Differentiate between “structure” and “class” ? Write a program to sum all of the contents of an array of size 100?

7 7 Revision What is wrong with this code: class Volume { private : int x ; public : void SetX(int y) { x=y;} }; main() { Volume v; v.x =90; }

8 8 Revision What is wrong with the following code: class Volume { private : int x ; public : void SetX( int y ) { x=y; } } main() { Volume *v; v.SetX(10); }

9 9 Revision What is wrong with the following code: struct StudentRecord { char *name;// student name double hw[3];// homework grades double test[2];// test grades double ave;// final average }; main() { StudentRecord stu; Stu->hw[0]=“test”; }

10 10 Revision A “constructor” is a function that is called automatically when the program is terminated (true/false)? A “destructor” is a function that is called automatically when the program is terminated (true/false)?

11 11 Revision Which constructor is called in the following code: class Volume { private : int x ; public : Volume() { cout<< “I am the empty constructor “; } Volume( int m) { cout<< “I am the second constructor “; } void SetX( int y ) { x=y; } }; main() { Volume *first, second (8); }

12 12 Revision It is a must to create “constructor” and “destructor” for each class? (true/false) What is the difference between “interpreter” and “compiler” ? Using class concept, write a program to compute the area of triangle without calling any function inside the main?

13 13 Revision C++ is : High level language Object orientated language An obsolete language


Download ppt "Computer Engineering 2 nd Semester Dr. Rabie A. Ramadan 3."

Similar presentations


Ads by Google