2. 1. How any types of linkage are there in c+?
a) 1
b) 2
c) 3
d) 4
2. To use internal linkage we have to use which keyword?
a) static
b) extern
c) static or extern
d) none of the mentioned
Answer: A
Answer: C
3. 3. Which one is used to refer to program elements in any translation
units?
a) internal linkage
b) external linkage
c) no linkage
d) none of the mentioned
4. What is the defualt type oof linkage that are available for
identifires?
a) internal
b) external
c) no linkage
d) none of the mentioned
Answer: B
Answer: B
4. 5. Pick out the other definition of objects.
a) member of the class
b) associate of the class
c) attribute of the class
d) instance of the class
6. How many objects can present in a single class?
a) 1
b) 2
c) 3
d) as many as possible
Answer: D
Answer: D
5. 7. To use external linkage we have to use which keyword?
a) static
b) extern
c) const
d) none of the mentioned
8. Which is used to use a function from one source file to another?
a) code
b) declaration
c) prototype
d) none of the mentioned
Answer: B
Answer: C
6. 9. Which is used to define the member of a class externally?
a) :
b) ::
c) #
d) none of the mentioned
10. Which other keywords are also used to declare the class
other than class?
a) struct
b) union
c) object
d) both a & b
Answer: B
Answer: D
7. 11. What is the use of no linkage?
a) make the entity visible to other programs
b) make the entity visible to other blocks in the same program.
c) make the entity visible only to that block
d) none of the mentioned
12. Which of these following members are not accessed by using
direct member access operator?
a) public
b) private
c) protected
d) Both b & c
Answer: C
Answer: D
8. 13. Which of the following is a valid class declaration?
a) class A { int x; };
b) class B { }
c) public class A { }
d) object A { int x; };
14. The fields in the class in c++ program are by default
a) protected
b) private
c) public
d) none of the mentioned
Answer: A
Answer: B
9. 15. Where does the object is created?
a) class
b) constructor
c) destructor
d) attributes
16. How to access the object in the class?
a) scope resolution operator
b) ternary operator
c) direct member access operator
d) none of the mentioned
Answer: A
Answer: C
10. 17. What does your class can hold?
a) data
b) functions
c) both a & b
d) none of the mentioned
18. How many specifiers are present in access specifiers in class?
a) 1
b) 2
c) 3
d) 4
View Answer
Answer: C
Answer: C
11. 19. Constructors are used to
a) initalize the objects
b) construct the data members
c) both a & b
d) none of the mentioned
20. When struct is used instead of the keyword class means, what
will happen in the program?
a) access is public by default
b) access is private by default
c) access is protected by default
d) none of the mentioned
Answer: A
Answer: A
12. 21. What is the output of this program?
1.#include <iostream>
2.using namespace std;
3.int main()
4.{
5.int i;
6.enum month {
7.JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,DEC
8.};
9.for (i = JAN; i <= DEC; i++)
10.cout << i;
11.return 0;
12.}
a) 012345678910
b) 0123456789
c) 01234567891011
d) none of the mentioned
Answer: A
13. 22. Which keyword is used to define the user defined data types?
a) def
b) union
c) typedef
d) type
23. Identify the correct statement.
a) typedef does not create different types.It only creates synonyms of
existing types.
b) typedef create different types.
c) both a & b
d) none of the mentioned
Answer: C
Answer: A
14. 24. What is the syntax of user-defined data types?
a) typedef_existing data type_new name
b) typedef_new name_existing data type
c) def_existing data type_new name
d) none of the mentioned
25. How many types of user-defined data type are in c++?
a) 1
b) 2
c) 3
d) 4 Answer: C
Answer: A
15. 26. What is the scope of typedef defined data types?
a) inside that block only
b) whole program
c) outside the program
d) none of the mentioned
Answer: B
Answer: B
27. How many types of models are available to create the user-
defined data type?
a) 1
b) 2
c) 3
d) 4
16. 28. Pick the other name of operator function.
a) function overloading
b) operator overloading
c) member overloading
d) None of the mentioned
29. Which of the following operators can’t be overloaded?
a) ::
b) +
c) –
d) []
Answer: B
Answer: A
17. 30. How to declare operator function?
a) operator operator sign
b) operator
c) operator sign
d) None of the mentioned
31. How many real types are there in complex numbers?
a) 1
b) 2
c) 3
d) 4 Answer: C
Answer: A
18. 32. Which of the following statements is NOT valid about operator
overloading?
a) Only existing operators can be overloaded.
b) Overloaded operator must have at least one operand of its class type.
c) The overloaded operators follow the syntax rules of the original
operator.
d) None of the mentioned
33. Operator overloading is
a) making c++ operator works with objects
b) giving new meaning to existing operator
c) making new operator
d) both a & b
Answer: D
Answer: D
19. 34. Which header file is used to declare the complex number?
a) complexnum
b) complex
c) complexnumber
d) None of the mentioned
35. How to declare the complex number?
a) (3,4)
b) complex(3,4)
c) (3,4i)
d) None of the mentioned
Answer: B
Answer: B
20. 36. Which of the following is not a function of complex values?
a) real
b) imag
c) norm
d) cartesian
37. How many parameters does a conversion operator may take?
a) 0
b) 1
c) 2
d) as many as possible
Answer: D
Answer: A
21. 38. What is the return type of the conversion operator?
a) void
b) int
c) float
d) no return type
Answer: A
Answer: D
39. Why we use the “dynamic_cast” type conversion?
a) result of the type conversion is a valid
b) to be used in low memory
c) result of the type conversion is a invalid
d) None of the mentioned
22. 40. How types are there in user defined conversion?
a) 1
b) 2
c) 3
d) 4
Answer: B
Answer: A
41. Pick out the correct syntax of operator conversion.
a) operator float()const
b) operator float()
c) operator const
d) None of the mentioned
23. 42. Which rule will not affect the friend function?
a) private and protected members of a class cannot be accessed from
outside
b) private and protected member can be accessed anywhere
c) both a & b
d) None of the mentioned
Answer: B
Answer: A
43. Which keyword is used to declare the friend function?
a) firend
b) friend
c) classfriend
d) myfriend
24. 44. What is the syntax of friend function?
a) friend class1 Class2;
b) friend class;
c) friend class
d) None of the mentioned
45. What will happen when the function call operator is overloaded?
a) It will not modify the functions.
b) It will modify the functions.
c) It will modify the object.
d) It will modify the operator to be interpreted.
Answer: A
Answer: D
25. 46. Pick out the correct statement.
a) A friend function may be a member of another class.
b) A friend function may not be a member of another class.
c) A friend function may or may not be a member of another class.
d) None of the mentioned
Answer: C
Answer: A
47. Where does keyword ‘friend’ should be placed?
a) function declaration
b) function definition
c) main function
d) None of the mentioned
26. 48. To which of the following access specifiers are applicable?
a) Member data
b) Functions
c) Both a & b
d) None of the mentioned
49. Which of the following advantages we lose by using multiple
inheritance?
a) Dynamic binding
b) Polymorphism
c) Both a & b
d) None of the mentioned
Answer: C
Answer: C
27. 50. What is the default access level to a block of data?
a) Public
b) Protected
c) Private
d) None of the mentioned
51. What is the importance of mutable keyword?
a) It allows the data member to change within a const
member function.
b) It will not allow the data member to change within a
const member function.
c) It will copy the values of the variable.
d) None of the mentioned
Answer: c
Answer: a
28. 52. What is meant by multiple inheritance?
a) Deriving a base class from derived class
b) Deriving a derived class from base class
c) Deriving a derived class from more than one base class
d) None of the mentioned
Answer: c
Answer: b
53. Which symbol is used to create multiple inheritance?
a) Dot
b) Comma
c) Dollar
d) None of the mentioned
29. 54. Which design patterns benefit from the multiple inheritance?
a) Adapter and observer pattern
b) Code pattern
c) Glue pattern
d) None of the mentioned
Answer: d
Answer: a
55. What are the things are inherited from the base class?
a) Constructor and its destructor
b) Operator=() members
c) Friends
d) All of the mentioned
30. 56. Which is an instantiation of the basic_string class template?
a) Character
b) String class
c) Memory
d) None of the mentioned
Answer: b
Answer: b
57. Which character is used to terminate the string?
a) $
b) Null
c) Empty
d) None of the mentioned
31. 58. Where are the strings stored?
a) Stack
b) Heap
c) Both a & b
d) None of the mentioned
Answer: C
Answer: C
59. What will happen if a string is empty?
a) It can’t be created
b) Raises an error
c) It can be used
d) None of the mentioned
32. 60. Where are standard C libraries defined in C++?
a) Container
b) std namespace
c) list
d) None of the mentioned
Answer: B
Answer: A
61. Which of the following have their changes in their
declaration related to constness of parameter?
a) strchr
b) string
c) memory
d) None of the mentioned
33. 62. What is the difference between unsigned int length() and
unsigned int size()?
a) Returns a different value
b) They are same
c) Both a & b
d) None of the mentioned Answer: B
Answer: C
63. How many parameters can a resize method take?
a) 1
b) 2
c) 1 or 2
d) 2
34. 64. What is the output of this program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("Steve jobs");
cout << str.capacity() << "n";
return 0;
}
a) 9
b) 10
c) 11
d) 12
Answer: B
35. 65. Which constant member functions does not modify the string?
a) bool empty()
b) assign
c) append
d) None of the mentioned
66. How many elements does a floating point number is composed
of?
a) 1
b) 2
c) 3
d) 4
Answer: A
Answer: D
36. 67. What is the use of function call operator?
a) overloading the methods
b) overloading the objects
c) overloading the parameters
d) none of the mentioned
68. Pick out the correct statement.
a) virtual functions does not give the ability to write a templated
function.
b) virtual functions does not give the ability to rewrite a templated
function.
c) virtual functions does give the ability to write a templated
function.
d) none of the mentioned
Answer: A
Answer: B
37. 69. How does the strings are stored in the memory?
a) Contiguous
b) Non-contiguous
c) Null
d) All of the mentioned
Answer: A