Sunteți pe pagina 1din 7

Objective Question:-

1. In C++, the function main () has a default return type


a. Float
b. Integer
c. Character
d. None of the above
2. Borland C++ consists of
a. ANSI Standard C Compiler
b. C++ Compiler
c. both
d. none of the above
3. The exit() function is supported by
a. Math.h
b. Process.h
c. Graphics.h
d. Dos.h
4. Function overloading means
a. Different function with different names
b. Function names are same with same arguments
c. Function names are same with different arguments
d. None of the above
5. A program with only one function is observed in
a. Monolithic programming language
b. Object oriented language
c. Structured programming language
d. None of the above
6. The packing of data and function into a single component is known as
a. Encapsulation
b. Polymorphism
c. Abstraction
d. None of the above
7. Method by which object of one class get the properties of object of another class is known as -
a. Inheritance
b. Encapsulation
c. Abstraction
d. None of the above
8. The mechanism that allow same function to act differently on different classes is known as
a. Polymorphism
b. Encapsulation
c. Inheritance
d. None of the above
9. The existing class can be reused by
a. Inheritance
b. Polymorphism
c. Dynamic binding
d. Data hiding
10. Composition of an object in a class is
a. Delegation
b. Inheritance
c. polymorphism
d. Abstraction
11. A class
a. Binds the data and its related function together
b. Data and their addresses
c. Contains only function
d. None of the above
12. The major drawback of procedure programming language is
a. Frequently invoking function from main()
b. Non security of data
c. Non security of method
d. None of the above
13. The Set. Precision () is used to set
a. Number of digits
b. Decimal places
c. Field width
d. None of the above
14. To fill unused section of the field, the character is set by the function
a. fill()
b. width()
c. precision()
d. None of the above
15. The manipulator <<endl is equivalent to
a. ‘\n’
b. ‘\t’
c. ‘\b’
d. ‘\a’
16. This function accept the string with blank space
a. cin
b. scanf()
c. getline();
d. none of the above
17. The stream is
a. Flow of integer
b. Flow of data
c. Flow of statement
d. None of the above
18. The statement cout<<hex<<15; gives the data in
a. Hexadecimal format
b. Octal format
c. Binary format
d. Decimal format
19. The gcount() function counts the
a. Inserted character
b. Unformatted extracted character
c. Both (a) and (b)
d. None of the above
20. The buffer is used to move the data between
a. Input and output device
b. I/O devices and computer
c. Input devices to storage devices
d. None of the above
21. The buffer is a
a. block of memory
b. Part of RAM
c. Part of hard disk
d. None of the above
22. Templates are suitable for
a. Any data type
b. Basic data type
c. Derived data type
d. All of the above
23. Consider the statement “virtual void display()=0.” The display() function is
a. Pure virtual function
b. Pure member function
c. Normal function
d. All of the above
24. When a base class is not used for object declaration is called
a. Abstract class
b. Container class
c. concrete class
d. derived class
25. a pointer to base class object can hold address of
a. only derived class object
b. only base class object
c. address of the base class object and derived class object
d. None of the above
26. Dynamic binding is done using
a. Virtual function
b. Inline function
c. Static function
d. Void
27. The new operator is used to
a. Allocate the memory
b. Deallocate the memory
c. Delete object
d. None of the above
28. The object itself is a
a. Pointer
b. Variable
c. Class member
d. None of the above
29. What will happen if you assign values in few location of an array
a. Rest of the element is set to 0
b. Compiler error message will be displayed
c. Possible system crash
d. None of the above
30. int x[5] , *p ; and p=x; then, which one operation is wrong between them
a. x++;
b. p++;
c. p=x;
d. none of the above
31. the template class is also called
a. generic class
b. container class
c. virtual class
d. base class
32. in the statement temp <void> x where temp is the class template,
a. object x can be used to pass integer values
b. object x can be used to pass float values
c. object x cannot be used to pass values but can invoke member function
d. none of the above
33. observe the following program:-
void show (int x)
{cout<<x;}//normal function
template <class T>
void show (T t) { cout<<”\t” <<t;//template function
void main()
{
show(5);
}
Which function will be invoked first?
a. Normal function
b. Template function
c. Ambiguity is generated
d. None of the above
34. The statement in.seekg(0,ios::end) sets the file pointer
a. At the end of the file
b. At the beginning of the file
c. In the middle of the file
d. None of the above
35. The write() function write
a. Single character
b. An object
c. A string
d. None of the above
36. Class A is a base class of class B. the relationship between them
a. Is a kind of relationship
b. Has a relationship
c. Is a relationship
d. None of the above
37. The ambiguity of members normally occurred in
a. single inheritance
b. multiple inheritance
c. multilevel inheritance
d. none of the above
38. the class is declared virtual when
a. two or more classes involved in inheritance have a common base class
b. more than one class is derived
c. we want to prevent a base class from inheritance
d. none of the above
39. in the following program, class A is an
class A{ int x;}
class B { int y;}
void main () { B b; }
a. abstract class
b. virtual class
c. derived class
d. none of the above
40. In the following program, the objects of which class can be access all member variables?
struct A { int x; };
struct B: A { int y };
struct C: B { int z; };
struct D: C { int k; };
a. Object of class D
b. Object of class B
c. Object of class C
d. Object of class A
41. The protected keyword allows
a. Derived class to access Base class members directly
b. Prevents direct access of public members
c. Allows objects to access private members
d. All of the above
42. Private data members of a class can be accessed by
a. Public member function of similar class
b. Directly by the object
c. Private member function of similar class
d. None of the above
43. In multilevel inheritance, the middle class act as
a. Base class as well as derived class
b. Only base class
c. Only derived class
d. None of the above
44. Function defined outside the class can be accessed using
a. Scope resolution operator
b. Logical operator
c. Reference
d. Conditional operator
45. Inline function is not possible when
a. A function contains a loop
b. Goto statement exist
c. Both (a) and (b)
d. None of the above
46. A static data member can be recognized
a. Inside scope of class
b. Outside the class
c. In main() function
d. In non- member function
47. A static member function can accessed
a. Only static member variable
b. Non-static member variable
c. Only non-static member variable
d. Static as well as non-static member variable
48. The class without any data members or member function is called
a. Empty class
b. Non- Empty class
c. Both (a) and (b)
d. None of the above
49. When memory allocation is essential, the constructor make implicit call to
a. new operator
b. malloc()
c. memset()
d. Random access memory
50. Function template can accepts
a. Only one parameter
b. Only two parameter
c. any number of parameter
d. None of the above
51. Which operator ca not be overloaded?
a. +
b. –
c. *
d. ::
52. What should be the output of below prpgram?
int main()
{
int a=10; cout<<a++;
return 0;
}
a. 11
b. 10
c. Error
d. 0
53. Can we typecast void into int?
a. Yes
b. No
c. Undefined
d. Depends on Compiler
54. Which of the following manipulator is used for the representing octal equivalent of a given decimal
number?
a. Oct
b. setbase(8)
c. tobase(8)
d. Both (a) and (b)
55. ___________ header file is used for manipulators.
a. < iomanipulator.h>
b. < stdiomanip.h>
c. < stdmanip.h>
d. < iomanip.h>
56. Predict the output:
int x = 786;
cout <<setfill(‘*’)<<setw(6)<<x;
a. 786***
b. . **786
c. ***786
d. ******
57. Which of the following perfect set of operators can’t be overloaded in CPP?
a. +=, ?, :: , >>
b. >>, <<, ?, *, sizeof()
c. :: , . , .* , ?:
d. :: , ->, * , new, delete
58. When overloading unary operators using Friend function, it requires_____ argument/s.
a. Zero
b. One
c. Two
d. None of the above
59. Using friend operator function, following perfect set of operators may not be overloaded.
a. = , ( ) , [ ] , ->
b. <<, = = , [ ] , >>
c. ?, = , ( ) , ++
d. None of the above
60. In case of binary operator overloading with member function, which of following statement should
be taken into consideration?
a. Right hand operand must be object
b. left hand operand must be object
c. Both the operands must be objects
d. None of the above

S-ar putea să vă placă și