Escolar Documentos
Profissional Documentos
Cultura Documentos
1. (a) What are the chief weakness of procedural languages ? How are they covered
in object oriented programming languages ?
(b) What are the most important common features of procedural languages and
object oriented programming languages ? [8+8]
3. (a) Describe the mechanism of accessing data members and member functions in
the following cases.
i. Inside the main program
ii. Inside a member function of the same class
iii. Inside a member function of another class
(b) When do you declare a member function of a class static? [12+4]
4. (a) How can a base class protect derived classes so that changes to the base class
will not affect them? Explain?
(b) When should a data member be protected: rather than private: ?
(c) Why is private: the default access level for a class? [5+6+5]
6. (a) write a program that will read the value of x and evaluate the function
z = 2 for x>0
z = 0 for x=0
z = -2 for x<0
using
i. nested if statements
ii. else if statements
1 of 2
Code No: NR410212 NR
iii. conditional operator
(b) In what ways does a switch statement differ from an if statement. Give ex-
amples. [8+8]
?????
2 of 2