What will be output of following program?
#include
What is meaning of following declaration? int(*ptr[5])();
ptr is pointer to function.
ptr is pointer to array of function.
ptr is pointer to such function which return type is array.
ptr is pointer to array of function.
Answer: Option B.
Here ptr is array not pointer.
What will be output if you will compile and execute the following c code? #include
Analyse the following code snippet and choose the answer:-
#include Class Temp { private:
int m_ival;
public:
Temp()
{
Cout<<"OBJECT CREATED\n"< }
~Temp()
{
Cout<<"OBJECT DESTROYED\n"< }
};
void fnRead()
{
Temp oTempObj;
}
int main()
{
fnRead();
cout<<"IN MAIN \n"< return 0;
}
OBJECT CREATED OBJECT DESTROYED
OBJECT CREATED OBJECT DESTROYED IN MAIN
OBJECT CREATED IN MAIN
Compilation Error
Answer: Option B.
Observe the following code and chose the correct statement(s)
class Name
{
const char *s ;.
};
class Table
{
Name *p; size_t sz ; public :
Table(size_ts = 15) {p = new Name [sz = s]; }
~Table() {delete [ ]p ;}
Name * lookup(const char *);
bool insert(Name *);
};
Which of the following are essential features of object-oriented programming languages?
Abstraction and encapsulation
Strictly-typedness
Type-safe property coupled with sub-type rule
Polymorphism in the presence of inheritance
1. 1 and 2 only
1 and 4 only
1,2 and 4 only
1,3 and 4 only
Answer: Option B.
Object oriented programming language is Object based PL+Abstraction + Inheritance. The last two (abstraction and inheritance) are must for any L to be OOPL.