

MCQOPTIONS
Saved Bookmarks
This section includes 542 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science knowledge and support exam preparation. Choose a topic below to get started.
51. |
With a template class, _____ type is generic |
A. | no |
B. | exactly one |
C. | at least one |
D. | at most one |
Answer» D. at most one | |
52. |
When you create a derived class and instantiate an object _____ |
A. | the parent class object must be constructed first |
B. | the child class object must be constructed first |
C. | the parent class object must not be constructed |
D. | the child class object must not be constructed |
Answer» B. the child class object must be constructed first | |
53. |
Which of the following statements will assign the address of the age variable to the agePtr pointer? |
A. | agePtr = &age; |
B. | agePtr = *age; |
C. | &agePtr = age; |
D. | *agePtr = age; |
Answer» B. agePtr = *age; | |
54. |
Private data can be accessed by |
A. | class member functions |
B. | functions in derived classes |
C. | both (a) and (b) |
D. | neither (a) nor (b) |
Answer» B. functions in derived classes | |
55. |
The purpose of a conditional operator is to |
A. | select one of the two values |
B. | select the highest of the two values |
C. | select one of the two values depending on a condition |
D. | select the more equal of the two values |
Answer» D. select the more equal of the two values | |
56. |
When accessing a structure member, the identifier to the left of the dot operator is the name of |
A. | a structure member |
B. | a structure tag |
C. | a structure variable |
D. | the keyword struct |
Answer» D. the keyword struct | |
57. |
"C++" is a _____ constant |
A. | character literal |
B. | named literal |
C. | numeric literal |
D. | string literal |
Answer» E. | |
58. |
A constructor may be _____ |
A. | provided automatically by C++ |
B. | written by you |
C. | either (a) or (b). |
D. | neither (a) nor (b). |
Answer» D. neither (a) nor (b). | |
59. |
Which of the following are valid characters constants? |
A. | '\n' |
B. | '\\' |
C. | '\0' |
D. | All of the above |
Answer» E. | |
60. |
Which of the following is the fourth problem-solving step? |
A. | analyze the problem |
B. | evaluate and modify (if necessary) the program |
C. | code the algorithm |
D. | plan the algorithm |
Answer» D. plan the algorithm | |
61. |
Access specifiers are followed by |
A. | a comma |
B. | a semicolon |
C. | a colon |
D. | two colons |
Answer» D. two colons | |
62. |
The extraction operator >> is a(n) |
A. | overloaded function |
B. | C++ class |
C. | C++ object |
D. | static reference variable |
Answer» B. C++ class | |
63. |
When variables refer to attributes of an entity (such as name, address, and phone number of a person), those attributes form a _____ |
A. | file |
B. | record |
C. | field |
D. | program |
Answer» C. field | |
64. |
Which of the following flowchart symbols represents the if selection structure? |
A. | diamond |
B. | hexagon |
C. | oval |
D. | parallelogram |
Answer» B. hexagon | |
65. |
A 'C function does not contain |
A. | a function header |
B. | argument declarations |
C. | other 'C' functions |
D. | function body |
Answer» D. function body | |
66. |
If a derived class uses the public access specifier, then _____ |
A. | public base class members remain public in the derived class |
B. | protected base class members become public in the derived class |
C. | both (a) and (b) |
D. | neither (a) nor (b) |
Answer» B. protected base class members become public in the derived class | |
67. |
Assume a program contains a void function named displayName, which requires no formal parameters. Which of the following is a correct function prototype for this function? |
A. | displayName; |
B. | displayName(void); |
C. | void displayName; |
D. | void displayName(); |
Answer» E. | |
68. |
Which of the following while clause will stop the loop when the value in the age variable is less than the number 0? |
A. | while age < 0 |
B. | while (age < 0) |
C. | while age >= 0; |
D. | while (age >= 0); |
Answer» E. | |
69. |
Variables that hold memory addresses are called _____ |
A. | subscripts |
B. | holders |
C. | pointers |
D. | indicators |
Answer» D. indicators | |
70. |
Element doubleArray[7] is which element of the array? |
A. | the sixth |
B. | the seventh |
C. | the eighth |
D. | impossible to tell |
Answer» D. impossible to tell | |
71. |
The return type for all destructors is |
A. | the class |
B. | void |
C. | the same as the first data in the class |
D. | None |
Answer» E. | |
72. |
Which of the following is an access specifier? |
A. | particular |
B. | shielded |
C. | protected |
D. | safe |
Answer» D. safe | |
73. |
Modules in C++ programs are |
A. | functions |
B. | procedures |
C. | subroutines |
D. | miniprograms |
Answer» B. procedures | |
74. |
Variable names known only to the procedure in which they are declared are ________ |
A. | local |
B. | global |
C. | recent |
D. | internal |
Answer» B. global | |
75. |
Assume a class Derv that is privately derived from class Base. An object of class Derv located in main() can access |
A. | public members of Base |
B. | protected members of Base |
C. | private members of Base |
D. | public members of Derv |
Answer» B. protected members of Base | |
76. |
In which statements, does a 'continue' statements cause the control to go directly to the test condition and then continue the looping process? |
A. | 'for' and 'while' |
B. | 'while' and 'if-else' |
C. | 'do-while' and 'if-else' |
D. | 'while' and 'do-while' |
Answer» E. | |
77. |
The contents of two pointers that point to adjacent of type float differ by |
A. | one bytes |
B. | two bytes |
C. | three bytes |
D. | four bytes |
Answer» E. | |
78. |
The feature in object-oriented programming that allows the same operation to be carried out differently, depending on the object, is_____ |
A. | inheritance |
B. | polymorphism |
C. | overfunctioning |
D. | overriding |
Answer» C. overfunctioning | |
79. |
A normal C++ operator that acts in special ways on newly defined data types is said to be |
A. | glorified |
B. | encapsulated |
C. | classified |
D. | overloaded |
Answer» E. | |
80. |
The end of string is recognized by |
A. | the null character |
B. | the newline character |
C. | the $ sign |
D. | the / sign |
Answer» B. the newline character | |
81. |
Reference variables and const class member |
A. | must be assigned values in any derived class |
B. | must never be initialized in a base class |
C. | must be initialized, rather than assigned values |
D. | must not exit if a class is to be a base class |
Answer» D. must not exit if a class is to be a base class | |
82. |
The letter V is a _____ |
A. | character literal constant |
B. | numeric literal constant |
C. | string literal constant |
D. | variable |
Answer» B. numeric literal constant | |
83. |
An identifier in C |
A. | is a name of a thing such as variable and function |
B. | is made up of letters, numerals, and the underscore |
C. | can contain both uppercase and lowercase letters |
D. | All of the above |
Answer» E. | |
84. |
A(n) _____ is always incremented by a constant amount, whereas a(n) _____ is incremented by an amount that varies |
A. | accumulator, counter |
B. | counter, accumulator |
Answer» C. | |
85. |
The code class Descendant : virtual public Ancestor indicates that |
A. | the members of Ancestor will be included more than once in Descendant |
B. | the members of Ancestor will be included only once in Descendant |
C. | the members of Descendant will be included more than once in Ancestor |
D. | the members of Descendant will be included only once in Ancestor |
Answer» C. the members of Descendant will be included more than once in Ancestor | |
86. |
Which of the following C++ expressions is equivalent to the mathematical expression 53 ? |
A. | 5 ^ 3 |
B. | cube(5) |
C. | pow (3, 5) |
D. | pow(5, 3) |
Answer» E. | |
87. |
Storing a class definition in a separate file is an example of |
A. | polymorphism |
B. | name mangling |
C. | implementation hiding |
D. | inheritance |
Answer» D. inheritance | |
88. |
The number of structures than can be declared in a single statement is |
A. | one |
B. | two |
C. | three |
D. | unlimited |
Answer» E. | |
89. |
The major advantage of data hiding is that _____ |
A. | your programs can include more data |
B. | you no longer need functions |
C. | no one can ever use your data |
D. | your data will be used correctly |
Answer» E. | |
90. |
One of the relational operators in the C language is |
A. | != |
B. | && |
C. | ! |
D. | # |
Answer» B. && | |
91. |
When the compiler cannot differentiate between two overloaded constructors, they are called______ |
A. | overloaded |
B. | destructed |
C. | ambiguous |
D. | dubious |
Answer» D. dubious | |
92. |
Programmers prefer to declare almost all variables _____ |
A. | at the beginning of each function |
B. | globally |
C. | on one line |
D. | with cryptic names |
Answer» B. globally | |
93. |
Which of the following statements declares a variable that can contain a decimal number? |
A. | dec payRate; |
B. | dec hourlyPay |
C. | float payRate |
D. | float hourlyPay; |
Answer» E. | |
94. |
In the statement template
|
A. | T is a class |
B. | T is a scalar variable |
C. | either (a) or (b) |
D. | neither (a) nor (b) |
Answer» D. neither (a) nor (b) | |
95. |
The most efficient data type for a variable that stores the letter C is the _____ data type |
A. | Character |
B. | Double |
C. | Float |
D. | Long Integer |
Answer» B. Double | |
96. |
To write data that contains variables of type float, to an object of type ofstream, you should use |
A. | the insertion operator |
B. | seekg() |
C. | writeQ |
D. | put() |
Answer» D. put() | |
97. |
Which of the following is not a programming control structure? |
A. | repetition |
B. | selection |
C. | sequency |
D. | sorting |
Answer» E. | |
98. |
To use a template class member function, use the ________ with the instantiation |
A. | scope resolution operator |
B. | dot operator |
C. | class definition |
D. | keword template |
Answer» C. class definition | |
99. |
To use one of the C++ built-in mathematical functions, you must include the _____ header file in your program |
A. | calculation.h |
B. | compute.h |
C. | expression.h |
D. | math.h |
Answer» E. | |
100. |
The difference between a return and a throw is that _____ |
A. | with a throw, no value can be sent |
B. | with a return, no value can be sent |
C. | with a throw, execution takes place at the location from which the function was called |
D. | with a return, execution takes place at the location from which the function was called |
Answer» E. | |