Which of the following type of class allows only one object of it to be created?
? Virtual class ? Abstract class ? Singleton class ? Friend class
Which of the following is not a type of constructor?
? Copy constructor ? Friend constructor ? Default constructor ? Parameterized constructor
Which of the following statements is correct?
? Base class pointer cannot point to derived class. ? Derived class pointer cannot point to base class. ? Pointer to derived class cannot be created. ? Pointer to derived class cannot be created.
Which of the following is not the member of class?
? Static function ? Friend function ? Const function ? Virtual function
Which of the following concepts means determining at runtime what method to invoke?
? Data hiding ? Dynamic Typing ? Dynamic binding ? Dynamic loading
Which of the following term is used for a function defined inside a class?
? Member Variable ? Member function ? Class function ? Classic function
Which of the following concept of oops allows compiler to insert arguments in a function call if it is not specified?
? Call by value ? Call by reference ? Default arguments ? Call by pointer
How many instances of an abstract class can be created?
? 1 ? 5 ? 13 ? 0
Which of the following cannot be friend?
? Function ? Class ? Object ? Operator function
Which of the following concepts of OOPS means exposing only necessary information to client?
? Encapsulation ? Abstraction ? Data hiding ? Data Binding
Why reference is not same as a pointer?
? A reference can never be null. ? A reference once established cannot be changed. ? Reference doesn't need an explicit dereferencing mechanism. ? All of these
cout is a/an __________ .
? operator ? function ? object ? macro
Which of the following concepts provides facility of using object of one class inside another class?
? Encapsulation ? Abstraction ? Composition ? Inheritance
How many types of polymorphisms are supported by C++?
? 1 ? 2 ? 3 ? 4
Which of the following is an abstract data type?
? int ? double ? string ? class
Which of the following concepts means adding new components to a program as it runs?
? Data hiding ? Dynamic typing ? Dynamic binding ? Dynamic loading
Which of the following statement is correct?
? A constructor is called at the time of declaration of an object. ? A constructor is called at the time of use of an object. ? A constructor is called at the time of declaration of a class. ? A constructor is called at the time of use of a class.
Which of the following correctly describes overloading of functions?
? Virtual polymorphism ? Transient polymorphism ? Ad-hoc polymorphism ? Pseudo polymorphism
Which of the following approach is adapted by C++?
? Top-down ? Bottom-up ? Right-left ? Left-right
Which of the following is correct about function overloading?
? The types of arguments are different ? The order of argument is different. ? The number of argument is same. ? Both A and B
Which of the following is correct about class and structure?
? class can have member functions while structure cannot. ? class data members are public by default while that of structure are private. ? Pointer to structure or classes cannot be declared. ? class data members are private by default while that of structure are public by default.
Which of the following concepts means wrapping up of data and functions together?
? Abstraction ? Encapsulation ? Inheritance ? Polymorphism
Which of the following concepts means waiting until runtime to determine which function to call?
? Data hiding ? Dynamic casting ? Dynamic binding ? Dynamic loading
How "Late binding" is implemented in C++?
? Using C++ tables ? Using Virtual tables ? Using Indexed virtual tablesUsing Indexed virtual tables ? Using polymorphic tables
Which of the following operator is overloaded for object cout? Which of the following operator is overloaded for object cout? Which of the following operator is overloaded for object cout?
? >> ? << ? + ? =
Delaration a pointer more than once may cause ____
? error ? abort ? trap ? null
Which one is not a correct variable type in C++?
? float ? real ? int ? double
An expression A.B in C++ means ____
? . A is member of object B ? B is member of Object A ? Product of A and B ? None of these
A C++ code line ends with ___
? A Semicolon (;) ? A Fullstop(.) ? A Comma (,) ? A Comma (,)
______ function is used to allocate space for array in memory.
? malloc() ? realloc() ? alloc() ? new()
A ponter pointing to a variable that is not initialized is called ____
? void Pointer ? null Pointer ? empty Pointer ? empty Pointer
Default constructor has ____ arguments.
? No argument ? One argument ? Two argument ? None of these
A class whose objects can not be created is known as _____
? absurd class ? dead class ? super class ? abstract class
Reusability of code in C++ is achieved through ____
? polymorphism ? inheritance ? enapsulation ? both A and B
In CPP, members of a class are ______ by default.
? public ? private ? protected ? static
In C++ Program, inline fuctions are expanded during ____
? run time ? compile time ? debug time ? coding time
To perfor file input / output operation in C++, we must include which header file ?
? ? ? ?
An exception in C++ can be generated using which keywords.
? thrown ? threw ? throw ? throws
Which of the following is true about const member functions?
? const members can be invoked on both const as well as nonconst objects ? const members can be invoked only on const objects and not on nonconst objects ? nonconst members can be invoked on const objects as well as nonconst objects ? none of these
Which of the following relationship is known as inheritance relationship?
? ‘has-a’ relationship ? ‘is-a’ relationship ? association relationship ? none of these
If class A is friend of class B and if class B is friend of class C, which of the following is true?
? Class C is friend of class A ? Class A is friend of class C ? Class A and Class C do not have any friend relationship ? None of these
A direct access file is:
? A file in which recoreds are arranged in a way they are inserted in a file ? A file in which records are arranged in a particular order ? Files which are stored on a direct access storage medium ? None of these
Which of the following is not a component of file system
? Access method ? Auxiliary storage management ? Free integrity mechanism ? None of these
Which of the following are good reasons to use an object oriented language?
? You can define your data types ? Program statements are simpler than in procedural languages. ? An OO program can be taught to correct its own errors. ? It's easier to conceptualize an OO program.
When a language has the capacity to produce new data type, it is said to be
? Reprehensible ? Encapsulated ? Overload ? Extensible
A normal C++ operator that acts in a special way on newly defined data types is said to be
? Glorified ? Encapsulated ? Classified ? Overloaded
Sharing of common information are achieved by the concept of
? Virtual copying ? Inheritance ? Encapsulation ? None of these
In a for loop with a multi-statement loop body, semicolons should appear following
? The for statement itself ? The closing brace in a multi-statement loop body ? C Each statement within the loop body. ? The test expression
A variable defined within a block is visible
? From the point of definition onwards in the program ? From the point of definition onwards in the function ? From the point of definition onwards in the block ? Throughout the function
The library function exit() causes an exit from
? The loop in which it occurs ? The block in which it occurs ? The function in which it occurs ? The program in which it occurs
The getch() library function
? Returns a character when any key is pressed ? Returns a character when ENTER is pressed ? Display a character on the screen when a key is pressed ? Does not display a character on the screen
_______ argument(s) are passed in case of binary overloaded operators.
? 2 ? 1 ? no ? none of the above
_______ argument(s) are passed in case of unary overloaded operators.
? 2 ? 1 ? no ? none of the above
The && and || operators
? Compare two numeric values ? Combine two numeric values ? Compare two Boolean values ? Combine two Boolean values
The break statement causes an exit
? Only from the innermost loop ? Only from the innermost switch ? From all loops and switch ? Only from the innermost loops or switch
When accessing a structure member, the identifier to the left of the dot operator is the name of
? Structure member ? Structure tag ? Structure variable ? The keyword struct.
cc ___________ option is used only to create object file
? -a ? -o ? -c ? none of these
:: is known as
? scope resolution operator ? global operator ? both A and B ? None of these
Which of the following can legitimately be passed to a function?
? const ? variable ? structure ? header file
_____________ operator must have one class object
? + ? New ? All ? none of these
Overloaded functions
? Are a group of functions with the same name ? All have the same number and types of arguments ? Make life simpler for programmer ? May fail unexpectedly due to stress
The template function declaration specifies
? template class ? a generic class ? exception ? identifier
In C++ ………………… operator is used for Dynamic memory allocation.
? scope resolution ? conditional ? new ? delete
Operators such as …………………. cannot be overloaded.
? + ? ++ ? :: ? ==
Which function return the current position of the get or put pointer in bytes.
? tellg( ) ? tellp( ) ? tell() ? both Aand B
To overload an operator ………………… keyword must be used along with the operator to be overloaded.
? over ? overload ? operator ? void
#include void main() { int n=1; cout<<endl<<“The numbers are;”<<endl; do { cout <<n<<“t”; n++; } while (n<=100); cout <<endl; }
? Print natural numbers 0 to 99 ? Print natural numbers 1 to 99 ? Print natural numbers 0 to 100 ? Print natural numbers 1 to 100
Everything defined at the program scope level (ie. outside functions and classes) is said to be ……………
? local scope ? regional scope ? global scope ? static slope
What does the following statement mean? int (*fp)(char*)
? pointer to a pointer ? pointer to an array of chars ? pointer to function taking a char* argument and returns an int ? function taking a char* argument and returning a pointer to in
Which of the following is illegal?
? int *ip; ? string s, *sp = 0; ? int i; double* dp = &i; ? int *pi = 0;
What will happen in this code? int a = 100, b = 200; int *p = &a, *q = &b; p = q;
? b is assigned to a ? p now points to b ? a is assigned to b ? q now points to a
#include using namespace std; int main() { int a = 5, b = 10, c = 15; int *arr[ ] = {&a, &b, &c}; cout << arr[1]; return 0; }
? 5 ? 10 ? 15 ? random value
#include using namespace std; int main() { char arr[20]; int i; for(i = 0; i < 10; i++) *(arr + i) = 65 + i; *(arr + i) = '\0'; cout << arr; return(0); }
? ABCDEFGHIJ ? AAAAAAAAAA ? 15 ? random value
#include using namespace std; int main() { char *ptr; char Str[] = "abcdefg"; ptr = Str; ptr += 5; cout << ptr; return 0; }
? fg ? cdef ? defg
Which is used to define the member of a class externally?
? : ? :: ? # ? &
#include using namespace std; class rect { int x, y; public: void val (int, int); int area () { return (x * y); } }; void rect::val (int a, int b) { x = a; y = b; } int main () { rect rect; rect.val (3, 4); cout << "rect area: " << rect.area(); return 0; }
? rect area:10 ? rect area: 12 ? rect area: 24 ? rect area:36
#include using namespace std; class CDummy { public: int isitme (CDummy& param); }; int CDummy::isitme (CDummy& param) { if (¶m == this) return true; else return false; } int main () { CDummy a; CDummy *b = &a; if (b->isitme(a)) { cout << "execute"; } else { cout<<"not execute"; } return 0; }
? execute ? not execute ? both execute and not execute ? none of these
Which of the following is a valid class declaration
? class A { int x; }; ? class B { } ? public class A { } ? object A { int x; };
When struct is used instead of the keyword class means, what will happen in the program?
? access is public by default ? access is private by default ? access is protected by default ? none of these
#include using namespace std; int main() { typedef int num; num a = 10, b = 15; num c = a + b + a - b; cout << c; return 0; }
? 20 ? 15 ? 25 ? 30