Explore topic-wise MCQs in Engineering.

This section includes 4320 Mcqs, each offering curated multiple-choice questions to sharpen your Engineering knowledge and support exam preparation. Choose a topic below to get started.

901.

The preprocessor directive always ends with

A. a comma
B. a semicolon
C. neither a semicolon nor a comma
D. "/"
E. None of the above
Answer» D. "/"
902.

A constructor initialization list produces similar results to

A. overriding
B. assignment
C. redeclaring
D. output
Answer» C. redeclaring
903.

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.
904.

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.
905.

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
E. the called function can change the value of the variable in the calling function
Answer» F.
906.

Any output manipulator function you create _____

A. should take as an argument an instance of ostream as a reference
B. should return void
C. must be a member function of the ostream class
D. must inherit ostream
Answer» B. should return void
907.

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.
908.

The instructions you enter into the computer are called the _____

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

The C++ operator used to allocate memory is _________

A. mem
B. allocate
C. new
D. create
Answer» D. create
910.

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
911.

A derived class may also be called a

A. subclass
B. super class
C. parent class
D. base class
Answer» B. super class
912.

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;
E. agePtr -> *age;
Answer» B. agePtr = *age;
913.

The >> (extraction) operator stops reading characters from the keyboard as soon as the user _____

A. presses the Enter key
B. types a character that is inappropriate for the variable's data type
C. both (a) and (b)
Answer» D.
914.

In the statement template<class T>,

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)
915.

Procedural cohesion is similar to sequential cohesion, except that with procedural cohesion _____

A. the tasks are not done in order
B. the tasks are simpler
C. the tasks share data
D. the tasks do not share data
Answer» E.
916.

The best-written classes have

A. all functions private
B. all data public
C. no functions
D. None of the above
Answer» E.
917.

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
918.

_____ variables remain in memory until the statement block ends

A. Area
B. Global
C. Local
D. Reference
E. Value
Answer» D. Reference
919.

The break statement is

A. a preprocessor directive
B. an operator in the C++ language
C. a keyword in the C++ language
D. switch in the C++ language
E. None of the above
Answer» D. switch in the C++ language
920.

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";
921.

The getline() function reads a line of text until _____

A. the length used as the second argument is reached
B. the character used as the third argument is reached
C. either (a) or (b)
D. neither (a) nor (b)
Answer» D. neither (a) nor (b)
922.

The extraction operator >> is a(n)

A. overloaded function
B. C++ class
C. C++ object
D. static reference variable
Answer» B. C++ class
923.

One drawback to returning an error code from a function is _____

A. functions cannot return error codes
B. error codes must be integers, and some functions can't return an integer
C. a function can return only one value, so it can return only the error code
D. a function that returns an error code will identify all returns as errors
Answer» D. a function that returns an error code will identify all returns as errors
924.

Assuming the following three operators appear in an expression (without parentheses), which of the operators will be performed first?

A. &&
B. !
C. ||
Answer» C. ||
925.

An address is a _____ , while a pointer is a _____

A. array, variable
B. constant, variable
C. variable, position
D. variable, location
Answer» E.
926.

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
927.

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
928.

Recursive Functions

A. easier to code
B. executable faster than iterative ones
C. takes less main storage space
D. necessary to solve a certain class of problems
E. None of the above
Answer» E. None of the above
929.

The actual arguments cannot he

A. a constant or a variable
B. of a different type from the corresponding formal arguments
C. other functions
D. expressions
E. None of the above
Answer» C. other functions
930.

The function stricmp("Jose", "JOSE") will return _____

A. - 1
B. 0
C. 1
Answer» C. 1
931.

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
932.

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).
933.

You can place function templates

A. at the end of main()
B. at the start of a program above main()
C. in two files-one for the definition and one for the function
D. any of the above
Answer» C. in two files-one for the definition and one for the function
934.

The two operators && an || are

A. arithmetic operators
B. equality operators
C. logical operators
D. relational operators
E. None of the above
Answer» D. relational operators
935.

Static variables are sometimes called

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

The statement double val[15]={44.123456};

A. assigns the value 44.123456 to all members of the array val
B. assigns the value 44.123456 to val[0] and 0 to the rest of the members
C. gives an error message
D. assigns the value 44.12345 to val[1] and val[5]
Answer» C. gives an error message
937.

The variables declared in a statement block or listed in a function header's parameterlist are considered _____ variables

A. area
B. global
C. local
D. reference
E. value
Answer» D. reference
938.

An expression

A. is a collection of data objects and operators that can be evaluated to a single value
B. is a name that substitutes for a sequence of characters
C. causes the computer to carry out some action
D. All of the above
E. None of the above
Answer» B. is a name that substitutes for a sequence of characters
939.

Any #include files may contain

A. constants
B. variables
C. functions
D. All of the above
Answer» E.
940.

When a break statement is used in a loop, the control skips the rest of the statements in the loop after it and jumps

A. to the last lines in the program
B. to the next statement written after the body of the loop
C. to the first statement in the body of the loop
D. All. of the above
E. None of the above
Answer» C. to the first statement in the body of the loop
941.

The function that takes arguments to set the bits of count is _____

A. setf()
B. bitsef()
C. ios()
D. flag()
Answer» B. bitsef()
942.

When two types are used in a function template and one is labeled T, the other

A. must also be named T
B. must be named U
C. can be any legal C++ identfier
D. it is illegal to have two types
Answer» B. must be named U
943.

If no constructors can specified for a derived class, objects of the derived class will use the constructors in the base class

A. True
B. False
Answer» B. False
944.

The get() function returns _____

A. a character
B. void
C. a reference to the object that invoked it
D. a copy of the object that invoked it
Answer» D. a copy of the object that invoked it
945.

The most efficient data type for a variable that the number 20000 is the _____ data type

A. Character
B. Double
C. Float
D. Long Integer
E. Short Integer
Answer» F.
946.

The number 5.5e3 is a _____ constant

A. character literal
B. named literal
C. numeric literal
D. string literal
Answer» D. string literal
947.

The compiler determines the type used in a template function via ___________

A. the name of the function
B. the first variable declared within the function
C. the type of the argument passed to the function
D. the type of the value returned from the function
Answer» D. the type of the value returned from the function
948.

Which symbol will be used with grep command to match the pattern pat at the beginning of a line?

A. ^pat
B. $pat
C. pat$
D. pat^
E. None of the above
Answer» B. $pat
949.

Which command is used to remove the read permission of the file 'note' from both the group and others?

A. chmod go+r note
B. chmod go+rw note
C. chmod go-x note
D. chmod go-r note
E. None of the above
Answer» E. None of the above
950.

Which of the following commands is used to display the directory attributes rather than its contents?

A. ls -l -d
B. ls -l
C. ls -x
D. ls -F
E. None of the above
Answer» B. ls -l