

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.
101. |
The keyword used to define a structure is |
A. | stru |
B. | stt |
C. | struct |
D. | unlimited |
Answer» D. unlimited | |
102. |
The rules to any programming language are its _______ |
A. | syntax |
B. | interpretation |
C. | logic |
D. | customs |
Answer» B. interpretation | |
103. |
The function whose prototype is void getData(Item *thing); receives |
A. | a pointer to a structure |
B. | a reference to a structure |
C. | a copy of a structure |
D. | nothing |
Answer» B. a reference to a structure | |
104. |
A C++ _____ is a program that runs in a DOS window |
A. | algorithm |
B. | cast application |
C. | console application |
D. | source application |
Answer» D. source application | |
105. |
_____ variables remain in memory until the program ends |
A. | Area |
B. | Global |
C. | Local |
D. | Reference |
Answer» C. Local | |
106. |
The statement int num[2][3]={ {3,8,6}, {9,4,7}}; |
A. | assigns a value 4 to num[1][2] |
B. | assigns a value 7 to num[1][2] |
C. | assigns a value 8 to num[1][2] |
D. | assigns a value 9 to num[1][2] |
Answer» C. assigns a value 8 to num[1][2] | |
107. |
The continue statement should be written only |
A. | in the body of a loop. |
B. | in the nested loops |
C. | outside the body of a loop |
D. | any where |
Answer» B. in the nested loops | |
108. |
Overloading involves writing two or more functions with ________ |
A. | different names and different argument lists |
B. | different names and the same argument list |
C. | the same name and different argument lists |
D. | the same name and the same argument list |
Answer» D. the same name and the same argument list | |
109. |
When the compiler places a copy of a small function's statements directly into a program, the function is said to be _____ |
A. | overloaded |
B. | mangled |
C. | inline |
D. | redundant |
Answer» D. redundant | |
110. |
You typically initialize Character variables to _____ |
A. | a space enclosed in double quotes |
B. | a space enclosed in single quotes |
C. | the letter O |
D. | the number 0 |
Answer» C. the letter O | |
111. |
Having more than one function with the same name is called |
A. | overloading |
B. | defaulting |
C. | casting |
D. | referencing |
Answer» B. defaulting | |
112. |
If an integer object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is _____ |
A. | const int & |
B. | int & |
C. | either (a) or (b) |
D. | neither (a) nor (b) |
Answer» D. neither (a) nor (b) | |
113. |
The keyword virtual indicates that |
A. | a derived class has public access to a base class |
B. | more than one base class exists |
C. | a base class should be used only once in inheritance |
D. | a derived class should have more than one base class constructed |
Answer» D. a derived class should have more than one base class constructed | |
114. |
The bitwise AND operator is represented by the symbol |
A. | ^ |
B. | & |
C. | && |
D. | >> |
Answer» C. && | |
115. |
A default constructor _____ |
A. | takes no arguments |
B. | has default values for all its arguments |
C. | either (a) or (b) |
D. | neither (a) nor (b). |
Answer» D. neither (a) nor (b). | |
116. |
Inheritance occurs when a class adopts all the traits of _________ |
A. | an object |
B. | a parent class |
C. | a variable |
D. | a function |
Answer» C. a variable | |
117. |
The dot operator (or class member access operator) connects the following two entities (reading from left to right): |
A. | a class member and a class object |
B. | a class object and a class |
C. | a class and a member of that class |
D. | a class object and a member of that class |
Answer» E. | |
118. |
When a function performs tasks based on a decision, it has _____ |
A. | functional cohesion |
B. | coincidental cohesion |
C. | logical cohesion |
D. | no cohesion |
Answer» D. no cohesion | |
119. |
The null character needs a space of |
A. | zero bytes |
B. | one byte |
C. | three bytes |
D. | four bytes |
Answer» C. three bytes | |
120. |
Which (if any) of the following is NOT a programmer-defined type |
A. | an array |
B. | a structure |
C. | a class |
D. | All of the above are programmer-defined types |
Answer» E. | |
121. |
_____ refers to the process of locating and removing the errors in a program |
A. | Analyzing |
B. | Correcting |
C. | Debugging |
D. | Executing |
Answer» D. Executing | |
122. |
It is illegal to make objects of one class members of another class |
A. | 1 |
B. | |
C. | depends upon the kind of object |
Answer» C. depends upon the kind of object | |
123. |
directives must be present |
A. | before the main() function |
B. | after the main() function |
C. | at the end of the program |
D. | anywhere in the program body |
Answer» B. after the main() function | |
124. |
If an integer object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is |
A. | int |
B. | double |
C. | either (a) or (b) |
D. | neither (a) nor (b) |
Answer» B. double | |
125. |
An asterisk placed after a data type means . |
A. | array to |
B. | pointer to |
C. | address to |
D. | located to |
Answer» C. address to | |
126. |
Making class members inaccessible to nonmember functions is an example of |
A. | polymorphism |
B. | data hiding |
C. | redundancy |
D. | recursion |
Answer» C. redundancy | |
127. |
Assume that a program contains a programmer-defined void function. When C++ encounters the function's closing brace (}), C++ returns to the statement _____ |
A. | immediately above the statement that called the function |
B. | that called the function |
C. | immediately below the statement that called the function |
Answer» D. | |
128. |
A group of related fields that contain all of the data about a specific person, place, or thing is called a |
A. | data file |
B. | field file |
C. | program file |
D. | record |
Answer» E. | |
129. |
The statement int num[2][3]={ {1,2}, {3,4}, {5, 6} }; |
A. | assigns a value 2 to num[1][2] |
B. | assigns a value 4 to num[1][2] |
C. | gives an error message |
D. | assigns a value 3 to num[1][2] |
Answer» D. assigns a value 3 to num[1][2] | |
130. |
Reference variables and const class members _____ |
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 exist if a class is to be a base class |
Answer» D. must not exist if a class is to be a base class | |
131. |
To pass an array by reference, you |
A. | must include the address-of (&) operator before the array's name |
B. | must include the number symbol (#) before the array's name |
C. | do not have to do anything because arrays are automatically passed by reference |
Answer» D. | |
132. |
A program can directly access the _____ members of a class |
A. | hidden |
B. | private |
C. | public |
D. | both (b) and (c) |
Answer» D. both (b) and (c) | |
133. |
When you write to a file rather than the screen, you use the C++ class _____ |
A. | iostream |
B. | filed |
C. | fstream |
D. | diskclass |
Answer» D. diskclass | |
134. |
If a base class member is private, then |
A. | if a derived class uses the public access specifier, the data member becomes public |
B. | if a derived class uses the protected access specifier, the data member becomes protected |
C. | both (a) and (b) |
D. | neither (a) nor (b) |
Answer» E. | |
135. |
The right shift operator is represented by the symbol |
A. | > |
B. | >> |
C. | -> |
D. | < |
Answer» C. -> | |
136. |
If two types of errors may be thrown, you should write _______ |
A. | no catch blocks |
B. | one catch block with two arguments |
C. | two catch block-one with an argument, and one without |
D. | two catch blocks with one argument each |
Answer» E. | |
137. |
A function argument is |
A. | a variable in the function that receives a value from the calling program |
B. | a way that functions resist accepting the calling program's values |
C. | a value sent to the function by the calling program |
D. | a value returned by the function to the calling program |
Answer» D. a value returned by the function to the calling program | |
138. |
Which of the following will store the number 320000 as a Float number? |
A. | counPop = (float) 3.2e5; |
B. | counPop = (float) 3.2e6; |
C. | counPop = (float) .32e5; |
D. | counPop = (float) .32e7; |
Answer» B. counPop = (float) 3.2e6; | |
139. |
A variable w with a value 67 may be defined with _______ |
A. | int w = 67; |
B. | int w(67); |
C. | int 67(w); |
D. | both (a) and (b), but not (c). |
Answer» E. | |
140. |
Assume that your version of C++ can recognize only the first 8 characters of an identifier name, through identifier names may be arbitrarily long. Which of the following identifier names is not distinct: |
A. | list, list2 |
B. | address, Address |
C. | identifier_l, identifier_2 |
D. | answer, ANSWER |
Answer» D. answer, ANSWER | |
141. |
Two access specifers in C++ are |
A. | public and private |
B. | int and double |
C. | formal and informal |
D. | void and free |
Answer» B. int and double | |
142. |
In C++, you use _____ to perform standard input and output operations |
A. | characters |
B. | sequences |
C. | streams |
D. | tests |
Answer» D. tests | |
143. |
The function that takes arguments to set the bits of cout is _____ |
A. | setf() |
B. | bitset() |
C. | ios() |
D. | flat() |
Answer» B. bitset() | |
144. |
A compound statement does not consist of |
A. | a single statement |
B. | other compound statements |
C. | expression statements |
D. | control statements |
Answer» B. other compound statements | |
145. |
Which is true? |
A. | Coincidental cohesion is stronger than procedural cohesion |
B. | Logical cohesion is stronger than coincidental cohesion |
C. | Sequential cohesion is weaker than temporal cohesion |
D. | The weakest cohesion is functional |
Answer» C. Sequential cohesion is weaker than temporal cohesion | |
146. |
The loop condition in a flowchart is represented by a(n) _____ |
A. | diamond |
B. | oval |
C. | parallelogram |
D. | rectangle |
Answer» B. oval | |
147. |
A difference, between reference variables and pointers is that |
A. | reference variables are easier to use |
B. | pointers are easier to use |
C. | reference variables are more flexible |
D. | no difference exists between reference variables and pointers |
Answer» B. pointers are easier to use | |
148. |
You must provide a constructor for a derived class |
A. | always |
B. | if the base class constructor required arguments |
C. | if the base class constructor does not required arguments |
D. | never |
Answer» C. if the base class constructor does not required arguments | |
149. |
Which of the following statements creates and initializes a pointer named salesPtr? |
A. | salesPtr = NULL; |
B. | *salesPtr = ""; |
C. | float &salesPtr = NULL; |
D. | float *salesPtr = ""; |
Answer» E. | |
150. |
The function printDataMembers() is mot likely a(n) ________ |
A. | inspector functions |
B. | mutator functions |
C. | auxiliary functions |
D. | manager functions |
Answer» B. mutator functions | |