MCQOPTIONS
Saved Bookmarks
This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
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 |
| A. | 1 and 2 only |
| B. | 1 and 4 only |
| C. | 1,2 and 4 only |
| D. | 1,3 and 4 only |
| Answer» C. 1,2 and 4 only | |
| 2. |
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 *); }; |
| A. | ~Table() is a destructor |
| B. | p is of Table type |
| C. | Both A and B |
| D. | insert() is a method which returns nothing |
| Answer» B. p is of Table type | |
| 3. |
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; } |
| A. | OBJECT CREATED OBJECT DESTROYED |
| B. | OBJECT CREATED OBJECT DESTROYED IN MAIN |
| C. | OBJECT CREATED IN MAIN |
| D. | Compilation Error |
| Answer» C. OBJECT CREATED IN MAIN | |
| 4. |
What will be output if you will compile and execute the following c code? #include int main(){ const int x=25; int * const p=&x; *p=2*x; printf("%d",x); return 0; } |
| A. | 25 |
| B. | 50 |
| C. | 0 |
| D. | Compiler error |
| Answer» C. 0 | |
| 5. |
What is meaning of following declaration? int(*ptr[5])(); |
| A. | ptr is pointer to function. |
| B. | ptr is pointer to array of function. |
| C. | ptr is pointer to such function which return type is array. |
| D. | ptr is pointer to array of function. |
| Answer» C. ptr is pointer to such function which return type is array. | |
| 6. |
What will be output of following program? #include int main(){ int i = 100; printf("value of i : %d addresss of i : %u",i,&i); i++; printf("\nvalue of i : %d addresss of i : %u",i,&i); return 0; } |
| A. | A. value of i : 100 addresss of i : Address value of i : 101 addresss of i : Address |
| B. | value of i : 100 addresss of i : Address value of i : 100 addresss of i : Address |
| C. | value of i : 101 addresss of i : Address value of i : 101 addresss of i : Address |
| D. | Compilation error |
| Answer» B. value of i : 100 addresss of i : Address value of i : 100 addresss of i : Address | |