

MCQOPTIONS
Saved Bookmarks
This section includes 97 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science Engineering (CSE) knowledge and support exam preparation. Choose a topic below to get started.
51. |
What will be the output of the following program? |
A. | compilation error: display() cannot be accessed in application |
B. | compilation error:test class object cannot be accessed in function demo |
C. | compilation error: variable x is private in test |
D. | both a and b |
Answer» D. both a and b | |
52. |
The only integer that can be assigned directly to a pointer is |
A. | 0 |
B. | -1 |
C. | 999 |
D. | -999 |
Answer» B. -1 | |
53. |
Which function will change the state of the object? |
A. | only set() |
B. | only display() |
C. | display() and set() both |
D. | none of the above |
Answer» B. only display() | |
54. |
What will be the output of the program? |
A. | 1 |
B. | default value |
C. | will not compile |
D. | none of the above |
Answer» D. none of the above | |
55. |
What is the compilation error for this program? |
A. | each undeclared identifier is reported only once |
B. | cout and cin not declared in scope |
C. | invalid conversion from int to float |
D. | all of the above |
Answer» C. invalid conversion from int to float | |
56. |
What value will be printed for data.i? |
A. | 10 220.5 230.5 unpredictable value |
B. | 220 |
C. | 230.5 |
D. | unpredictable value |
Answer» E. | |
57. |
Objects of the string class |
A. | are zero-terminated. |
B. | can be copied with the assignment operator. |
C. | do not require memory management. |
D. | both b and c |
Answer» E. | |
58. |
You should prefer C-strings to the Standard C++ string class in new programs. |
A. | true |
B. | false |
Answer» C. | |
59. |
What is value of size? |
A. | 28 |
B. | 32 |
C. | 20 |
D. | 24 |
Answer» D. 24 | |
60. |
Can destuctors be private in C++? |
A. | yes |
B. | no |
Answer» B. no | |
61. |
You can read input that consists of multiple lines of text using |
A. | the normal cout <<combination. |
B. | the cin.get() function with one argument. |
C. | the cin.get() function with two arguments. |
D. | the cin.get() function with three arguments. |
Answer» E. | |
62. |
The extraction operator (>>) stops reading a string when it encounters a space. |
A. | true |
B. | false |
Answer» B. false | |
63. |
The compiler will complain if you try to access array element 14 in a 10-element array. |
A. | true |
B. | false |
Answer» C. | |
64. |
When an array name is passed to a function, the function |
A. | accesses exactly the same array as the calling program. |
B. | refers to the array using a different name than that used by the calling program. |
C. | refers to the array using the same name as that used by the calling program. |
D. | a and b |
Answer» E. | |
65. |
In C++ there can be an array of four dimensions. |
A. | true |
B. | false |
Answer» B. false | |
66. |
A static local variable is used to |
A. | make a variable visible to several functions. |
B. | make a variable visible to only one function. |
C. | retain a value when a function is not executing. |
D. | b and c |
Answer» E. | |
67. |
Overloaded functions |
A. | are a group of functions with the same name. |
B. | all have the same number and types of arguments. |
C. | make life simpler for programmers. |
D. | a and c |
Answer» E. | |
68. |
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. | |
69. |
When a function returns a value, the entire function call can appear on the right side of the equal sign and be assigned to another variable. |
A. | true |
B. | false |
Answer» B. false | |
70. |
How many values can be returned from a function? |
A. | 0 |
B. | 1 |
C. | 2 |
D. | 3 |
Answer» C. 2 | |
71. |
Which of the following can legitimately be passed to a function? |
A. | a constant |
B. | a variable |
C. | a structure |
D. | all of the above |
Answer» E. | |
72. |
When arguments are passed by value, the function works with the original arguments in the calling program. |
A. | true |
B. | false |
Answer» C. | |
73. |
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. | |
74. |
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. | |
75. |
In an assignment statement, the value on the left of the equal sign is always equal to the value on the right. |
A. | true |
B. | false |
Answer» C. | |
76. |
A variable of type char can hold the value 301. |
A. | true |
B. | false |
Answer» C. | |
77. |
It’s perfectly all right to use variables of different data types in the same arithmetic expression. |
A. | true |
B. | false |
Answer» B. false | |
78. |
An expression |
A. | usually evaluates to a numerical value. |
B. | may be part of a statement. |
C. | always occurs outside a function. |
D. | option a and b |
Answer» E. | |
79. |
Dividing a program into functions |
A. | is the key to object-oriented programming. |
B. | makes the program easier to conceptualize. |
C. | may reduce the size of the program. |
D. | option b and c |
Answer» E. | |
80. |
For the object for which it was called, a const member function |
A. | can modify both const and non-const member data. |
B. | can modify only const member data. |
C. | can modify only non-const member data. |
D. | can modify neither const nor non-const member data. |
Answer» E. | |
81. |
Classes are useful because they |
A. | can closely model objects in the real world. |
B. | permit data to be hidden from other classes. |
C. | bring together all aspects of an entity in one place. |
D. | options a, b and c |
Answer» E. | |
82. |
A member function can always access the data |
A. | in the object of which it is a member. |
B. | in the class of which it is a member. |
C. | in any object of the class of which it is a member. |
D. | in the public part of its class. |
Answer» B. in the class of which it is a member. | |
83. |
In a class definition, data or functions designated private are accessible |
A. | to any function in the program. |
B. | only if you know the password. |
C. | to member functions of that class. |
D. | only to public members of the class. |
Answer» D. only to public members of the class. | |
84. |
Variables declared in the body of a particular member function are known as data members and can be used in all member functions of the class. |
A. | true |
B. | false |
Answer» C. | |
85. |
Which one of the following is not a valid reserved keyword in C++? |
A. | explicit |
B. | public |
C. | implicit |
D. | private |
Answer» D. private | |
86. |
When class B is inherited from class A, what is the order in which the constructers of those classes are called |
A. | class a first class b next |
B. | class b first class a next |
C. | class b's only as it is the child class |
D. | class a's only as it is the parent class |
Answer» B. class b first class a next | |
87. |
Under what conditions a destructor destroys an object? |
A. | scope of existence has finished |
B. | object dynamically assigned and it is released using the operator delete. |
C. | program terminated. |
D. | both a and b. |
Answer» E. | |
88. |
What is a constructor? |
A. | a class automatically called whenever a new object of this class is created. |
B. | a class automatically called whenever a new object of this class is destroyed. |
C. | a function automatically called whenever a new object of this class is created. |
D. | a function automatically called whenever a new object of this class is destroyed. |
Answer» D. a function automatically called whenever a new object of this class is destroyed. | |
89. |
Which one of the following is not a fundamental data type in C++? |
A. | float |
B. | string |
C. | int |
D. | char |
Answer» C. int | |
90. |
Which type of class has only one unique value for all the objects of that same class? |
A. | this |
B. | friend |
C. | static |
D. | both a and b |
Answer» D. both a and b | |
91. |
Which of the following operators allow defining the member functions of a class outside the class? |
A. | :: |
B. | ? |
C. | :? |
D. | % |
Answer» B. ? | |
92. |
There is nothing like a virtual constructor of a class. |
A. | true |
B. | false |
Answer» C. | |
93. |
The default access level assigned to members of a class is |
A. | private |
B. | public |
C. | protected |
D. | needs to be assigned |
Answer» B. public | |
94. |
An abstract class can be instantiated. |
A. | true |
B. | false |
Answer» C. | |
95. |
Can constructors be overloaded? |
A. | true |
B. | false |
Answer» B. false | |
96. |
What is the difference between struct and class in terms of Access Modifier? |
A. | by default all the struct members are private while by default class members are public. |
B. | by default all the struct members are protected while by default class members are private. |
C. | by default all the struct members are public while by default class members are private. |
D. | by default all the struct members are public while by default class members are protected. |
Answer» D. by default all the struct members are public while by default class members are protected. | |
97. |
Every class has at least one constructor function, even when none is declared. |
A. | true |
B. | false |
Answer» B. false | |