Explore topic-wise MCQs in Computer Science.

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.

201.

The printer can be accessed using the predefined filename _____

A. printer file
B. print
C. cout
D. PRN, LPT1, etc
Answer» E.
202.

Which of the following creates a String named constant called partNo, whose value is AB45?

A. const char[4] partNo = "AB45";
B. const char[5] partNo = 'AB45';
C. const char[5] partNo = "AB45";
D. const char partNo[5] = "AB45";
Answer» E.
203.

The statement i*=3 is equivalent to

A. i = 3*
B. i = 3
C. i* = 3
D. i = i * 3
Answer» E.
204.

The arguments that determine the state of the cout object are called _____

A. classes
B. manipulators
C. format flags
D. state controllers
Answer» D. state controllers
205.

The standard input stream, which refers to the keyboard, is called

A. cin
B. cout
C. stin
D. stout
Answer» B. cout
206.

A function's single most important role is to

A. give a name to a block of code
B. reduce program size
C. accept arguments and provide a return value
D. help organize a program into conceptual units
Answer» E.
207.

Which of the following will store the letter H in a Character variable named initial?

A. initial = 'H'
B. initial = 'H';
C. initial = "H"
D. initial = "H";
Answer» C. initial = "H"
208.

Student senior(); is a(n)_________

A. constructor call with no arguments
B. object instantiation
C. constructor call with all default arguments
D. prototype for a function that returns a student object
Answer» E.
209.

The preprocessor directive always ends with

A. a comma
B. a semicolon
C. neither a semicolon nor a comma
D. "/"
Answer» D. "/"
210.

The preprocessor directive always starts with the symbol

A. %
B. &
C. #
D. ""
Answer» D. ""
211.

Using new may result in less _____ memory than using an array

A. wasted
B. used
C. RAM
D. ROM
Answer» B. used
212.

The scope resolution operator is

A. a comma
B. a semicolon
C. a colon
D. two colons
Answer» E.
213.

Which of the following creates an animal object named dog?

A. animal "dog";
B. animal dog;
C. dog "animal";
D. dog animal;
Answer» C. dog "animal";
214.

The arguments that determine the state of the cout object are called

A. classes
B. manipulators
C. format flags or state flags
D. state controllers
Answer» D. state controllers
215.

The highest level of cohesion is

A. functional cohesion
B. temporal cohesion
C. logical cohesion
D. sequential cohesion
Answer» B. temporal cohesion
216.

Object is to class as _____

A. library is to book
B. mother is to daughter
C. Plato is to philosopher
D. president is to Lincoln
Answer» D. president is to Lincoln
217.

Which is a good reason for passing a variable's address to a function?

A. the function will have a copy of the variable
B. the function cannot change the value of the variable in the calling function
C. C++ requires that all variables used in a function be passed by address
D. the function needs to change multiple variable values
Answer» E.
218.

The while loop is referred to as a(n) _____ loop because the loop condition is tested at the beginning of the loop

A. beginning
B. initial
C. pretest
D. priming
Answer» D. priming
219.

The measure of how well the operations in a function relate to one another is _____

A. coupling
B. cohesion
C. adhesion
D. conversion
Answer» C. adhesion
220.

When you instantiate a derived class object, a constructor for the derived class _____

A. is not called
B. is called prior to the base class constructor
C. is called simultaneously with the base class constructor
D. None of the above
Answer» E.
221.

Separating parts of a program into units that remain unaffected by other parts of a program is the concept known as _____

A. intrusion
B. volatility
C. encapsulation
D. protection
Answer» D. protection
222.

Which of the following is the inequality operator?

A. !=
B. =
C. ==
D. -->
Answer» B. =
223.

When an object-oriented program detects an error within a function, the function _________

A. throws an exception
B. throws a fit
C. catches a message
D. catches an exception
Answer» B. throws a fit
224.

The C++ expression p --> val means the same thing as

A. *p.val
B. *(p.val)
C. (*p).vai
D. p.val
Answer» D. p.val
225.

Which of the following statements will create and initialize a feelnfo array named fee?

A. fee feeInfo = {{0}, {0}};
B. fee as feeInfo = 0, 0;
C. feeInfo fee = 0, 0;
D. feeInfo fee = [{0}, {0}];
Answer» E.
226.

The instructions you enter into the computer are called the _____

A. edited code
B. machine code
C. object code
D. source code
Answer» E.
227.

Evaluate the following expression: 4 >6 || 10 < 2 * 6

A. 1
B.
Answer» B.
228.

You indicate a variable is a pointer variable by placing a(n) _____ in front of the variable's name

A. asterisk
B. ampersand
C. dollar sign
D. exclamation point
Answer» B. ampersand
229.

Which is a good guideline for creating function names?

A. Use all lowercase letters to identify the functions as C++ functions
B. Use long names to reduce the likelihood of creating a duplicate function name
C. Use abbreviations as much as possible to save both keystrokes and memory
D. Avoid the use of digits because they are easily confused with letters
Answer» E.
230.

One way in which a structure differs from an array is that _____

A. a structure may have members of more than one type
B. a structure must have members that; are all the same type
C. art array may have members of more than one type
D. there is no difference between a structure and an array
Answer» B. a structure must have members that; are all the same type
231.

Which of the following instructions tells C++ to merge the source code from the iostream.h file into the current file?

A. #include <iostream.h>
B. #include iostream.h
C. #include <iostream.h>
D. #merge iostream.h
Answer» E.
232.

A derived class _____ override attributes of a parent class

A. may
B. may if the two classes have the same name
C. must
D. must not
Answer» B. may if the two classes have the same name
233.

An expression contains relational, assignment and arithmetic operators. In the absence of parentheses, the order of evaluation will be

A. assignment, relational, arithmetic
B. arithmetic, relational, assignment
C. relational, arithmetic, assignment
D. assignment, arithmetic, relational
Answer» C. relational, arithmetic, assignment
234.

The code that you enter into a C++ program is called _____

A. console code
B. object code
C. project code
D. source code
Answer» E.
235.

An auxiliary function _____

A. return information about data members
B. changes the state of data members
C. performs an action or service
D. creates and destroys objects
Answer» D. creates and destroys objects
236.

Format flags may be combined using the _____

A. bitwise OR operator(|)
B. logical OR operator (||)
C. bitwise AND operator (&)
D. logical AND operator (&&)
Answer» B. logical OR operator (||)
237.

When a new class is derived from an existing class, the derived class member functions _____ have names that differ from base class function names

A. may
B. may if the two classes have the same name
C. must
D. must not
Answer» B. may if the two classes have the same name
238.

The main() function is always

A. a called function
B. a calling function
C. recursive function
D. used at the end of the program
Answer» C. recursive function
239.

Which of the following statements creates a named constant called driverAge whose value is 16?

A. const driverAge = 16;
B. const short driverAge = 16;
C. driverAge =16;
D. driverAge const =16;
Answer» C. driverAge =16;
240.

An exception specification begins with the keyword _____

A. exception
B. try
C. throw
D. catch
Answer» D. catch
241.

Static variables are sometimes called

A. class variables
B. functional variables
C. dynamic variables
D. auto variables
Answer» B. functional variables
242.

A function that is prototyped as double calculate(int num); may______

A. receive an integer constant such as 5
B. receive an integer variable
C. either (a) or (b)
D. neither (a) nor (b)
Answer» D. neither (a) nor (b)
243.

Which of the following pairs of identifier name(s) are(is) considered to be identical?

A. name, names
B. smith, johnsmith
C. identifier 1, identifier_2
D. charl, char_l
Answer» D. charl, char_l
244.

You declare a function with a function _____, which is typically entered at the beginning of the program, below the #include directives

A. call
B. prototype declaration
C. definition
D. pointer
Answer» C. definition
245.

Which of the following is the extraction operator?

A. >>
B. <<
C. //
D. /*
Answer» B. <<
246.

A function in a derived class that has the same name as a function in the parent class

A. will override the base class function
B. will cause an error message to display
C. will be overridden by the base class function
D. will execute immediately often the base class function executes
Answer» B. will cause an error message to display
247.

A function in a derived class that has the same name as a function in the parent class _____

A. will cause an error message to display
B. will override the base class function
C. will be overridden by the base class function
D. will execute immediately after the base class function executes
Answer» C. will be overridden by the base class function
248.

You can pass _____ to functions

A. copies of individual structure members
B. copies of entire structures
C. pointers to structures
D. All of the above
Answer» E.
249.

The store of memory available to programs is the _____

A. store
B. stack
C. pile
D. heap
Answer» E.
250.

A variable declared in a function is called a(n) _____ variable

A. area
B. global
C. local
D. reference
Answer» D. reference