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.
| 151. |
Which of the following is the scope resolution operator? |
| A. | ->> |
| B. | :: |
| C. | * |
| D. | & |
| Answer» C. * | |
| 152. |
An advantage of using local variables is that _____ |
| A. | they are known to all functions in the file |
| B. | names used in one function do not affect data stored in variables with the same names in other functions |
| C. | values given to local variables are retained when those parameters go out of scope |
| D. | the program does not become "crowded" with too many variable names |
| Answer» E. | |
| 153. |
The function stricmp("Jose", "JOSE") will return _____ |
| A. | -1 |
| B. | 0 |
| C. | 1 |
| Answer» C. 1 | |
| 154. |
When a class is derived from another derived class, the newly derived class |
| A. | may have more liberal access to a base class member than its immediate predecessor |
| B. | may have the same type of access to a base class member as its immediate predecessor |
| C. | may have more limited access to a base class member than its immediate predecessor |
| D. | both (b) and (c) |
| Answer» D. both (b) and (c) | |
| 155. |
Object-oriented programmers primarily focus on _________ |
| A. | procedures to be performed |
| B. | the step-by-step statements needed to solve a problem |
| C. | objects and the tasks that must be performed with those objects |
| D. | the physical orientation of objects within a program |
| Answer» D. the physical orientation of objects within a program | |
| 156. |
The general principle underlying object-oriented error handling is that a called function should __________ |
| A. | neither check for, nor handle errors |
| B. | check for errors but not be required to handle any detected |
| C. | handle errors, but not check for them |
| D. | both check for and handle errors |
| Answer» C. handle errors, but not check for them | |
| 157. |
In the expression p --> val,p is a(n) |
| A. | address |
| B. | pointer |
| C. | structure |
| D. | header |
| Answer» C. structure | |
| 158. |
To create a variable, you must assign _____ to it |
| A. | a data type |
| B. | a name |
| C. | both a data type and a name |
| D. | the word var |
| Answer» D. the word var | |
| 159. |
In C++, class definitions are most often |
| A. | stored with each program that uses them |
| B. | stored in a header file that is included in the programs that use them |
| C. | stored in a folder that you paste into every new project |
| D. | retyped for every new project |
| Answer» C. stored in a folder that you paste into every new project | |
| 160. |
The string HELLO WORLD needs |
| A. | 11 bytes |
| B. | 12 bytes |
| C. | 10 Bytes |
| D. | 8 bytes |
| Answer» B. 12 bytes | |
| 161. |
Which of the following will increase the value stored in the first element of the fee array by 2? |
| A. | amount[0] = amount[0] + 2; |
| B. | amount, fee[0] = amount, fee [0] + 2; |
| C. | feelnfo.amount[0] = feelnfo.amount[0] + 2; |
| D. | fee[0].amount = fee[0].amount + 2; |
| Answer» E. | |
| 162. |
The braces that surround the code in a 'C program |
| A. | show what code goes in a particular function |
| B. | delimit a section of code |
| C. | separate the codes from the constant |
| D. | separate the source file from the subject file |
| Answer» C. separate the codes from the constant | |
| 163. |
Inheritance is the principle that |
| A. | classes with the same name must be derived from one another |
| B. | knowledge of a general category can be applied to more specific objects |
| C. | C++ functions may be used only if they have logical predecessors |
| D. | one function name may invoke different methods |
| Answer» C. C++ functions may be used only if they have logical predecessors | |
| 164. |
3 is a _____ constant |
| A. | character literal |
| B. | named literal |
| C. | numeric literal |
| D. | string literal |
| Answer» D. string literal | |
| 165. |
Many programmers separate a class into two files: _____ |
| A. | one for the declarations and one for the implementations |
| B. | one for the void functions and one for the other functions |
| C. | one for the public data and one for the private data |
| D. | one for the primary functions and one for the auxiliary functions |
| Answer» B. one for the void functions and one for the other functions | |
| 166. |
Which of the following is NOT included in the header of a function? |
| A. | the type of variable returned by the function to the function that calls it |
| B. | the name of the program or function that calls the function |
| C. | the name of the function |
| D. | the types and names of any variables that will be passed to the function |
| Answer» C. the name of the function | |
| 167. |
Before object-oriented exception handling was practiced, _____ |
| A. | no run-time errors occurred |
| B. | programmers could not deal with run-time errors |
| C. | the most popular error-handling method was to terminate the program |
| D. | the most popular error-handling method was to throw an exception |
| Answer» D. the most popular error-handling method was to throw an exception | |
| 168. |
Providing two or more constructors for the same class _____ |
| A. | requires different argument lists |
| B. | requires different constructor names |
| C. | requires different constructor types |
| D. | is illegal |
| Answer» B. requires different constructor names | |
| 169. |
A C++ statement must end in a |
| A. | : (column) |
| B. | , (comma) |
| C. | . (period) |
| D. | ; (semicolon) |
| Answer» E. | |
| 170. |
Each generic type in a template function definition is preceded by the keyword _________ |
| A. | template |
| B. | function |
| C. | type |
| D. | class |
| Answer» B. function | |
| 171. |
Compared with the classes from which they are derived, inherited classes may have _____ |
| A. | additional data members |
| B. | additional member functions |
| C. | both (a) and (b) |
| D. | neither (a) nor (b) |
| Answer» D. neither (a) nor (b) | |
| 172. |
Which of the following backslash codes used for bell? |
| A. | \b |
| B. | a |
| C. | \r |
| D. | \s |
| Answer» C. \r | |
| 173. |
We can output text to an object of class ofstream using the insertion operator ¬´ because |
| A. | the ofstream class is a stream |
| B. | the insertion operator works with all classes |
| C. | we are actually outputting to cout |
| D. | the insertion operator is overloaded in ofstream |
| Answer» E. | |
| 174. |
A function that is prototype as int calculate(int num); may |
| A. | receive an integer variable named num from the main() program |
| B. | receive any integer variable from the main() program |
| C. | either (a) or (b) |
| D. | neither (a) nor (b) |
| Answer» D. neither (a) nor (b) | |
| 175. |
When an argument is passed by reference, |
| A. | a variable is created in the function to hold the argument's value |
| B. | the function cannot access the argument's value |
| C. | a temporary variable is created in the calling program to hold the argument's value |
| D. | the function accesses the argument's original value in the calling program |
| Answer» E. | |
| 176. |
A translator that notes whether you have used a language correctly may be called a _____ |
| A. | theasurus |
| B. | compiler |
| C. | coder |
| D. | decoder |
| Answer» C. coder | |
| 177. |
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» C. a copy of a structure | |
| 178. |
Which of the following type casts will convert an Integer variable named amount to a Double type? |
| A. | (double) amount |
| B. | (int to double) amount |
| C. | int to double(amount) |
| D. | int (amount) to double |
| Answer» B. (int to double) amount | |
| 179. |
Hiding individual components of an entry is _____ |
| A. | polymorphism |
| B. | encapsulation |
| C. | scaling |
| D. | not recommended in C++ |
| Answer» C. scaling | |
| 180. |
A function that is prototyped as double calculate(int num); may ______ |
| A. | receive a double constant such as 3.9 |
| B. | receive a double variable |
| C. | either (a) or (b) |
| D. | neither (a) nor (b) |
| Answer» E. | |
| 181. |
Which function is most likely to have procedural cohesion? |
| A. | main() |
| B. | findSquareRoot() |
| C. | getSaleSubtractDiscountAddTax() |
| D. | openFiles() |
| Answer» B. findSquareRoot() | |
| 182. |
A class Stockltems has four data members and three function members. You define 50 objects as members of the class. Which is true? |
| A. | Only one copy of each of the tnree functions exists |
| B. | Only one copy of each of the four data members exists |
| C. | Both (a) and (b) are true |
| D. | Neither (a) nor (b) is true |
| Answer» B. Only one copy of each of the four data members exists | |
| 183. |
The bitwise OR operator is a |
| A. | unary operator |
| B. | binary operator |
| C. | ternary operator |
| D. | octal operator |
| Answer» C. ternary operator | |
| 184. |
The process of extracting the relevant attributes of an object is known as |
| A. | polymorphism |
| B. | inheritance |
| C. | abstraction |
| D. | data hiding |
| Answer» D. data hiding | |
| 185. |
A predefined function that may be used to handle memory allocation errors is |
| A. | handle_error |
| B. | set_new_handler |
| C. | new_fix |
| D. | memory_error |
| Answer» C. new_fix | |
| 186. |
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) | |
| 187. |
An unsigned double type of data |
| A. | can have only positive values |
| B. | does not exist |
| C. | is always less than 1010 |
| D. | can have only negative values |
| Answer» B. does not exist | |
| 188. |
When you create a derived class and instantiate on 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 | |
| 189. |
To create a template class, you begin with _________ |
| A. | the template definition |
| B. | the keyword class |
| C. | the function definitions |
| D. | the keyword definition |
| Answer» B. the keyword class | |
| 190. |
Which of the following are void functions? |
| A. | main |
| B. | pow |
| C. | sqrt |
| D. | All of the above |
| Answer» B. pow | |
| 191. |
When a function includes a throw statement for errors, the call to the potentially offending function should be placed within a _____ block |
| A. | throw |
| B. | try |
| C. | catch |
| D. | scope |
| Answer» C. catch | |
| 192. |
One way pointers are useful is to refer to a memory address that has no _____ |
| A. | name |
| B. | constant |
| C. | location |
| D. | field |
| Answer» B. constant | |
| 193. |
A variable's _____ indicates which portions of the program can use the variable |
| A. | area |
| B. | extent |
| C. | lifetime |
| D. | reach |
| Answer» E. | |
| 194. |
The statement float values[]={3.14, -7.86, 36.96, 4.87}; |
| A. | assigns 36.96 to values[2] |
| B. | assigns -7.86 to values[2] |
| C. | gives an error message |
| D. | assign 14 to values[2] |
| Answer» B. assigns -7.86 to values[2] | |
| 195. |
Template classes that have already been written to perform common class tasks are called _____ |
| A. | container classes |
| B. | receptacle classes |
| C. | repository classes |
| D. | alembic classes |
| Answer» B. receptacle classes | |
| 196. |
Which of the following, if any, are invalid names for a variable? |
| A. | bankAccountNumber |
| B. | first_Name |
| C. | doubleNumber |
| D. | operator |
| Answer» E. | |
| 197. |
The time and memory involved in calling a function represent the function's _____ |
| A. | prototype |
| B. | overhead |
| C. | cost |
| D. | burden |
| Answer» C. cost | |
| 198. |
The C++ _____ function generates random numbers |
| A. | generate() |
| B. | genRand |
| C. | rand |
| D. | randGen |
| Answer» E. | |
| 199. |
If the code and fee arrays are parallel, the fee that corresponds to the code stored in the code[3] element is located in the _____ element |
| A. | code[2] |
| B. | code[3] |
| C. | fee[2] |
| D. | fee[3] |
| Answer» E. | |
| 200. |
To create and execute a C++ program, you need to have access to |
| A. | a C++ compiler |
| B. | a C++ translator |
| C. | an object code editor |
| D. | a text editor |
| Answer» E. | |