MCQOPTIONS
Saved Bookmarks
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.
| 851. |
An array element is accessed using |
| A. | a first-in-first-out approach |
| B. | the dot operator |
| C. | a member name |
| D. | an index number |
| Answer» E. | |
| 852. |
The program can access the private members of a class |
| A. | directly |
| B. | only through other private members of the class |
| C. | only through other public members of the class |
| D. | None of the above - the program cannot access the private members of a class in any way |
| Answer» D. None of the above - the program cannot access the private members of a class in any way | |
| 853. |
Within a program, you can instantiate ________that have a class template type |
| A. | classes |
| B. | functions |
| C. | parameters |
| D. | objects |
| Answer» E. | |
| 854. |
The rules to any programming language are its _______ |
| A. | syntax |
| B. | interpretation |
| C. | logic |
| D. | customs |
| Answer» B. interpretation | |
| 855. |
You construct a class in two sections, known as the _____ |
| A. | header and body |
| B. | type and parameters |
| C. | declaration and implementation |
| D. | pointer and variable |
| Answer» D. pointer and variable | |
| 856. |
Which of the following backslash codes used for bell? |
| A. | b |
| B. | a |
| C. | r |
| D. | s |
| E. | None of the above |
| Answer» C. r | |
| 857. |
The last statement in a value-returning function is always _____ |
| A. | }; |
| B. | result expression; |
| C. | return; |
| D. | return expression; |
| Answer» E. | |
| 858. |
It is sometimes useful to specify a class from which no objects will ever be created |
| A. | True |
| B. | False |
| Answer» B. False | |
| 859. |
The statement i*=3 is equivalent to |
| A. | i = 3* |
| B. | i = 3 |
| C. | i* = 3 |
| D. | i = i * 3 |
| E. | None of the above |
| Answer» E. None of the above | |
| 860. |
The complement operator is represented by the symbol |
| A. | ~ |
| B. | ^ |
| C. | i |
| D. | < |
| E. | None of the above |
| Answer» B. ^ | |
| 861. |
It is illegal to make objects of one class members of another class |
| A. | True |
| B. | False |
| C. | depends upon the kind of object |
| Answer» C. depends upon the kind of object | |
| 862. |
Catch blocks must _____ |
| A. | appear in every object-oriented program |
| B. | appear within try blocks |
| C. | appear immediately after throw statements |
| D. | appear immediately after try blocks |
| Answer» E. | |
| 863. |
The number 125.35 is a _____ |
| A. | character literal constant |
| B. | numeric literal constant |
| C. | string literal constant |
| D. | variable |
| Answer» C. string literal constant | |
| 864. |
When a class serves as a base class to others, _____ |
| A. | all of its members are inherited |
| B. | all of its members are inherited, except for any private members |
| C. | all of its members are inherited, except for any protected members |
| D. | None of its members is inherited unless specifically "listed |
| Answer» C. all of its members are inherited, except for any protected members | |
| 865. |
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 | |
| 866. |
A class named student must have a constructor whose name is |
| A. | student |
| B. | ~student |
| C. | constructor |
| D. | any legal C++ name. |
| Answer» B. ~student | |
| 867. |
A class hierarchy |
| A. | describes "is a kind of" relationships |
| B. | describes "has a" relationships |
| C. | shows the same relationships as an organization chart |
| D. | shows the same relationships as a family tree |
| Answer» B. describes "has a" relationships | |
| 868. |
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) |
| E. | sqrt (5, 3) |
| Answer» E. sqrt (5, 3) | |
| 869. |
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 |
| E. | None of the above |
| Answer» D. select the more equal of the two values | |
| 870. |
Which of the following, if any, are valid names for variables? |
| A. | amt.Sold |
| B. | amt-Sold |
| C. | amt_Sold |
| D. | 98Sold |
| E. | None of the above are valid names for variables |
| Answer» D. 98Sold | |
| 871. |
Assume you want to compare the character stored in the initial variable to the letter a. Which of the following conditions should you use in the if statement? (Be sure the condition will handle a or A.) |
| A. | (initial = 'a' or 'A') |
| B. | (initial == 'a' or 'A') |
| C. | (toupper(initial) = 'A') |
| D. | (toupper(initial) == 'A') |
| Answer» E. | |
| 872. |
You can override a class's inherited access to make an individual member's access more ______ |
| A. | liberal |
| B. | conservative |
| C. | either (a) or (b) |
| D. | neither (a) nor (b) |
| Answer» C. either (a) or (b) | |
| 873. |
When the compiler cannot differentiate between two overloaded constructors, they are called______ |
| A. | overloaded |
| B. | destructed |
| C. | ambiguous |
| D. | dubious |
| Answer» D. dubious | |
| 874. |
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) | |
| 875. |
Passing a variable pointer as a constant _____ |
| A. | protects the contents pointed to by the pointer from change |
| B. | eliminates the need to name the pointer in the function |
| C. | eliminates the need to give the pointer a type in the function |
| D. | causes a copy of the pointer to be produced in the function |
| Answer» B. eliminates the need to name the pointer in the function | |
| 876. |
The _____ function returns the uppercase equivalent of a character |
| A. | caseupper |
| B. | charupper |
| C. | toupper |
| D. | uCase |
| E. | upper |
| Answer» D. uCase | |
| 877. |
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. | |
| 878. |
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). | |
| 879. |
Software that can be used in applications other than the one for which it was originally written is called |
| A. | recyclable |
| B. | inherited |
| C. | reusable |
| D. | cheating |
| Answer» D. cheating | |
| 880. |
The statement double total = 0.0; performs _____ |
| A. | assignment |
| B. | initialization |
| C. | rationalization |
| D. | polymorphism |
| Answer» C. rationalization | |
| 881. |
The two parts of a function are the |
| A. | header and footer |
| B. | declarations and statements |
| C. | legs and feet |
| D. | header and body |
| Answer» E. | |
| 882. |
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 | |
| 883. |
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 | |
| 884. |
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. | |
| 885. |
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. | |
| 886. |
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 |
| E. | None of the above |
| Answer» F. | |
| 887. |
Library header files usually contain |
| A. | complete functions |
| B. | parts of functions |
| C. | function prototypes for functions stored in other files |
| D. | function bodies, but not function headers |
| Answer» D. function bodies, but not function headers | |
| 888. |
The String data type is an extension of the _____ data type |
| A. | Character |
| B. | Double |
| C. | Letter |
| D. | Long |
| E. | Text |
| Answer» B. Double | |
| 889. |
When you define an object that is a member of a class, such as Student Abby; _____ |
| A. | a block of memory is set aside and all data members are assigned valid values |
| B. | a block of memory is set aside |
| C. | no memory is set aside until values are defined |
| D. | no memory is set aside, but valid values are assigned to data members |
| Answer» C. no memory is set aside until values are defined | |
| 890. |
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) | |
| 891. |
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. | |
| 892. |
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 |
| E. | None of the above |
| Answer» C. relational, arithmetic, assignment | |
| 893. |
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 | |
| 894. |
The instruction "If it's raining outside, then take an umbrella to work" is an example of the _____ structure |
| A. | control |
| B. | repetition |
| C. | selection |
| D. | sequence |
| E. | switching |
| Answer» D. sequence | |
| 895. |
Which of the following stream manipulators advances the cursor to the next line on the computer screen? |
| A. | adin |
| B. | advin |
| C. | edlin |
| D. | endl |
| E. | lineadv |
| Answer» E. lineadv | |
| 896. |
6.5 is a _____ constant |
| A. | character literal |
| B. | named literal |
| C. | numeric literal |
| D. | string literal |
| Answer» D. string literal | |
| 897. |
The time and memory involved in calling a function represent the function's _____ |
| A. | prototype |
| B. | overhead |
| C. | cost |
| D. | burden |
| Answer» C. cost | |
| 898. |
Which function is most likely to have procedural cohesion? |
| A. | main() |
| B. | findSquareRoot() |
| C. | getSaleSubtractDiscountAddTax() |
| D. | openFiles() |
| Answer» B. findSquareRoot() | |
| 899. |
A C++ term meaning "generic" is |
| A. | argument |
| B. | parameterized |
| C. | universal |
| D. | global |
| Answer» C. universal | |
| 900. |
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 | |