Id |
1 |
Question |
Every class has at least one
constructor function, even when none is declared. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
2 |
Question |
Can constructors be
overloaded? |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
3 |
Question |
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 |
C |
Marks |
1 |
Unit |
I |
Id |
4 |
Question |
An abstract class can be
instantiated. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
5 |
Question |
The default access level
assigned to members of a class is ______ |
A |
Private |
B |
Public |
C |
Protected |
D |
Needs to be assigned |
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
6 |
Question |
There is nothing like a
virtual constructor of a class. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
7 |
Question |
Which of the following
operators allow defining the member functions of a class outside the class? |
A |
:: |
B |
? |
C |
:? |
D |
% |
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
8 |
Question |
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 |
C |
Marks |
1 |
Unit |
I |
Id |
9 |
Question |
Which one of the following is
not a fundamental data type in C++? |
A |
Float |
B |
string |
C |
Int |
D |
Char |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
10 |
Question |
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 |
C |
Marks |
1 |
Unit |
I |
Id |
11 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
12 |
Question |
If a member needs to have
unique value for all the objects of that same class, declare the member as |
A |
Global variable outside class |
B |
Local variable inside
constructor |
C |
Static variable inside class |
D |
Dynamic variable inside class |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
13 |
Question |
If a member needs to have
unique value for all the objects of that same class, declare the member as |
A |
Global variable outside class |
B |
Local variable inside
constructor |
C |
Static variable inside class |
D |
Dynamic variable inside class |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
14 |
Question |
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 |
A |
Marks |
1 |
Unit |
I |
Id |
15 |
Question |
Which one of the following is
not a valid reserved keyword in C++? |
A |
Explicit |
B |
Public |
C |
Implicit |
D |
Private |
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
16 |
Question |
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 |
C |
|
D |
|
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
17 |
Question |
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 |
C |
Marks |
1 |
Unit |
I |
Id |
18 |
Question |
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 |
A |
Marks |
1 |
Unit |
I |
Id |
19 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
20 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
21 |
Question |
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 |
D |
Marks |
2 |
Unit |
I |
Id |
22 |
Question |
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 |
D |
Marks |
2 |
Unit |
I |
Id |
23 |
Question |
A variable of type char can
hold the value 301. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
24 |
Question |
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 |
C |
|
D |
|
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
25 |
Question |
It’s perfectly all right to
use variables of different data types in the same arithmetic expression. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
26 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
27 |
Question |
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 |
C |
Marks |
1 |
Unit |
I |
Id |
28 |
Question |
When arguments are passed by
value, the function works with the original arguments in the calling program. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
29 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
30 |
Question |
How many values can be
returned from a function? |
A |
0 |
B |
1 |
C |
2 |
D |
3 |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
31 |
Question |
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 |
C |
|
D |
|
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
32 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
33 |
Question |
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 |
D |
Marks |
2 |
Unit |
I |
Id |
34 |
Question |
A default argument has a value
that |
A |
may be supplied by the calling
program. |
B |
may be supplied by the
function. |
C |
must have a constant value. |
D |
A and B |
Answer |
1 |
Marks |
1 |
Unit |
I |
Id |
35 |
Question |
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 |
D |
Marks |
2 |
Unit |
I |
Id |
36 |
Question |
In C++ there can be an array
of four dimensions. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
37 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
38 |
Question |
The compiler will complain if
you try to access array element 14 in a 10-element array. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
39 |
Question |
The extraction operator
(>>) stops reading a string when it encounters a space. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
40 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
41 |
Question |
You should prefer C-strings to
the Standard C++ string class in new programs. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
42 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
43 |
Question |
Can destuctors be private in C++? |
A |
Yes |
B |
No |
C |
|
D |
|
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
44 |
Question |
What is value of size? |
A |
28 |
B |
32 |
C |
20 |
D |
24 |
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
45 |
Question |
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 |
D |
Marks |
1 |
Unit |
I |
Id |
46 |
Question |
|
A |
25 |
B |
30 |
C |
9 |
D |
3 |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
47 |
Question |
|
A |
1 |
B |
3 |
C |
4 |
D |
6 |
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
48 |
Question |
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 |
B |
Marks |
2 |
Unit |
I |
Id |
49 |
Question |
|
A |
45 |
B |
55 |
C |
Array Sum: 45 |
D |
Will not compile |
Answer |
D |
Marks |
2 |
Unit |
I |
Id |
50 |
Question |
|
A |
5 |
B |
20 |
C |
15 |
D |
Unpredictable value |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
51 |
Question |
|
A |
only 2 |
B |
only 1 |
C |
both 1 &2 |
D |
None of the above |
Answer |
B |
Marks |
2 |
Unit |
I |
Id |
52 |
Question |
|
A |
call-2 |
B |
call-1 |
C |
call-3 |
D |
call-1, call-2 |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
53 |
Question |
What will be the output of the
program? |
A |
1 |
B |
Default value |
C |
Will not compile |
D |
None of the above |
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
54 |
Question |
What is the output of the
program? |
A |
0 0 |
B |
x = 0 y = 0 |
C |
0 |
D |
Compilation error |
Answer |
D |
Marks |
1 |
Unit |
I |
Id |
55 |
Question |
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 |
A |
Marks |
2 |
Unit |
I |
Id |
56 |
Question |
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 |
C |
Marks |
2 |
Unit |
I |
Id |
57 |
Question |
The only integer that can be
assigned directly to a pointer is _________ |
A |
0 |
B |
-1 |
C |
999 |
D |
-999 |
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
58 |
Question |
Which of the following feature
is not supported by C++? |
A |
Exception Handling |
B |
Reflection |
C |
Operator Overloading |
D |
Namespace |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
59 |
Question |
Suppose aand bare
integer variables and we form the sum a + b. Now suppose cand dare
floating-point variables and we form the sum c + d.The two +operators
here are clearly being used for different purposes. This is an
example of ____________ |
A |
Operator Overloading |
B |
Inheritance |
C |
Function Overloading |
D |
Constructor |
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
60 |
Question |
The operators that cannot be
overloaded is |
A |
* |
B |
- |
C |
:: |
D |
() |
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
61 |
Question |
Empty parentheses following a
function name in a function prototype indicate that the function does not
require any parameters to perform its task. |
A |
TRUE |
B |
FALSE |
C |
|
D |
|
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
62 |
Question |
C++ programmers concentrate on
creating , which contain data members and the member functions that
manipulate those data members and provide services to clients. |
A |
Structures |
B |
Classes |
C |
Objects |
D |
Function |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
63 |
Question |
Which of the following is FALSE about references in C++ |
A |
A reference must be initialized when declared |
B |
Once a reference is created, it cannot be later made to
reference another object; it cannot be reset |
C |
References cannot be NULL |
D |
References cannot refer to constant value |
Answer |
D |
Marks |
1 |
Unit |
I |
Id |
64 |
Question |
What will be the output of
following program? #include <iostream> using namespace std; class Test { public: Test() { cout <<"Hello from
Test() "; } } a; int main() { cout <<"Main Started "; return 0; } |
A |
Main Started |
B |
Main Started Hello from Test() |
C |
Hello from Test() Main Started |
D |
Compiler Error: Global objects are not allowed |
Answer |
C |
Marks |
2 |
Unit |
I |
Id |
65 |
Question |
Which of the following is true about constructors. ·They cannot be virtual. · They cannot be private. ·They are automatically called by new operator |
A |
All 1, 2, and 3 |
B |
Only 1 and 3 |
C |
Only 1 and 2 |
D |
Only 2 and 3 |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
66 |
Question |
Which of the following
operators are overloaded by default by the compiler? 1) Comparison Operator ( == ) 2) Assignment Operator ( = ) |
A |
Both 1 and 2 |
B |
Only 1 |
C |
Only 2 |
D |
None of the two |
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
67 |
Question |
Which of the following is true about inline functions
and macros. |
A |
Inline functions do type checking for parameters,
macros don't |
B |
Macros cannot have return statement, inline functions
can |
C |
Macros are processed by pre-processor and inline
functions are processed in later stages of compilation. |
D |
All of the above |
Answer |
D |
Marks |
1 |
Unit |
I |
Id |
68 |
Question |
In C++, const qualifier can be applied to ·Member functions of a class ·Function arguments ·To a class data member which is declared as
static ·Reference variables |
A |
Only 1, 2 and 3 |
B |
Only 1, 2 and 4 |
C |
All |
D |
Only 1, 3 and 4 |
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
69 |
Question |
In C++ .....................
operator is used for Dynamic memory allocation. |
A |
Scope resolution |
B |
Conditional |
C |
New |
D |
Membership access |
Answer |
C |
Marks |
1 M |
Unit |
I |
Id |
70 |
Question |
What is the output of the
program #include<iostream.h> |
A |
Print natural numbers 0 to 99 |
B |
Print natural numbers 1 to 99 |
C |
Print natural numbers 0 to 100 |
D |
Print natural numbers 1 to 100 |
Answer |
D |
Marks |
2 M |
Unit |
I |
Id |
71 |
Question |
Because the lifetime of a
local variable is limited and determined automatically, these variables are
also called |
A |
Automator |
B |
Automatic |
C |
Dynamic |
D |
Static |
Answer |
B |
Marks |
1 M |
Unit |
I |
Id |
72 |
Question |
Which of the following header
file includes definition of cin and cout? |
A |
istream.h |
B |
ostream.h |
C |
iomanip.h |
D |
iostream.h |
Answer |
D |
Marks |
1 |
Unit |
I |
Id |
73 |
Question |
Which of the following
statements regarding inline functions is correct? |
A |
It speeds up execution |
B |
It slows down execution |
C |
It increases the code size |
D |
Both A and C. |
Answer |
D |
Marks |
1 |
Unit |
I |
Id |
74 |
Question |
Which of the following access
specifier is used as a default in a class definition? |
A |
Public |
B |
Private |
C |
Protected |
D |
Friend |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
75 |
Question |
Which of the following
statements is correct in C++? |
A |
Classes cannot have data as
protected members. |
B |
Structures can have functions
as members. |
C |
Class members are public by
default. |
D |
Structure members are private
by default. |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
76 |
Question |
cout is a/an __________ |
A |
operator |
B |
Function |
C |
object |
D |
Macro |
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
77 |
Question |
Which of the following
concepts of OOPS means exposing only necessary information to client? |
A |
Encapsulation |
B |
Abstraction |
C |
Data hiding |
D |
Data binding |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
78 |
Question |
Which of the following
keywords is used to control access to a class member? |
A |
Default |
B |
Break |
C |
Protected |
D |
Asm |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
79 |
Question |
Utility functions are also called as ....... |
A |
Virtual function |
B |
Friend function |
C |
Helper function |
D |
None of above |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
80 |
Question |
......... is a member function with the
same name as the class. |
A |
Friend function |
B |
Constructor |
C |
Destructor |
D |
None of above |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
81 |
Question |
Which is not the feature of constructor? |
A |
It cannot be inherited. |
B |
It should be declared in Private. |
C |
It do not have return type |
D |
All of above |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
82 |
Question |
Which is not type of constructor? |
A |
Default |
B |
Copy |
C |
Parameterized |
D |
None of above |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
83 |
Question |
Objects are destroyed in the reverse order
of its creation. |
A |
True |
B |
False |
C |
- |
D |
- |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
84 |
Question |
.... constructor is used for copying the
object of same class type. |
A |
Copy |
B |
Default |
C |
Parameterized |
D |
None of above |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
85 |
Question |
The function inside a class is called as
....... |
A |
Class Function |
B |
Member Function |
C |
Method |
D |
All of above |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
86 |
Question |
Which operator is used to define member
function of a class outside the class? |
A |
! |
B |
: |
C |
:: |
D |
. |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
87 |
Question |
How many objects can be created by a class? |
A |
1 |
B |
2 |
C |
3 |
D |
As Many as required |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
88 |
Question |
Default return type of C++ main( ) is ..... |
A |
float |
B |
void |
C |
Int |
D |
Pointer |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
89 |
Question |
Enumerated data type is ........ |
A |
User-defined data type |
B |
In-built data type |
C |
Derived data type |
D |
None of above |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
90 |
Question |
Attributes of a class are called as
........ |
A |
Member functions |
B |
Data members |
C |
Objects |
D |
All of above |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
91 |
Question |
Class acquire space in memory. |
A |
True |
B |
False |
C |
- |
D |
- |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
92 |
Question |
In object-oriented programming ........ is
more important. |
A |
Function |
B |
Procedure |
C |
Data |
D |
All of above |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
93 |
Question |
Object-oriented programming follows Top-down approach. |
A |
True |
B |
False |
C |
- |
D |
- |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
94 |
Question |
The following operators can
not be overloaded |
A |
Unary operator |
B |
Binary operator |
C |
Ternary operator |
D |
None of the above |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
95 |
Question |
C++ does not supports the following |
A |
Multilevel inheritance |
B |
Hierarchical inheritance |
C |
Hybrid inheritance |
D |
None of the above |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
96 |
Question |
Which of the following is not
the keyword in C++? |
A |
Volatile |
B |
Friend |
C |
Extends |
D |
This |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
97 |
Question |
Which data type can be used to
hold a wide character in C++? |
A |
unsigned char; |
B |
Int |
C |
wchar_t |
D |
None of the above |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
98 |
Question |
Which type is best suited to
represent the logical values? |
A |
integer |
B |
boolean |
C |
character |
D |
all of the mentioned |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
99 |
Question |
The following is the C++ style
comment |
A |
// |
B |
/*..*/ |
C |
– |
D |
None of above |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
100 |
Question |
Which of the following
statements is false? |
A |
Every C++ program must have a
main(). |
B |
In C++, white spaces and
carriage returns are ignored by the compiler. |
C |
C++ statements terminate with
semicolon. |
D |
Main() terminates with
semicolon. |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
101 |
Question |
Which of the following
statements regarding comments is false? |
A |
/*..*/ |
B |
Comment beginning with // extends
to the end of the line |
C |
Comments may be nested |
D |
Comments are used to describe
a program |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
102 |
Question |
The result of the following statement is int y = 7; |
A |
ans=7, y=7 |
B |
ans=8,y=7 |
C |
ans=8,y=8; |
D |
None |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
103 |
Question |
Inline functions are |
A |
Declared in the class defined
outside the class |
B |
Defined outside the class
using keyword inline |
C |
Defined inside the class using
keyword inline |
D |
None of the above |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
104 |
Question |
Functions can returns |
A |
Arrays |
B |
References |
C |
Objects |
D |
All of above |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
105 |
Question |
Which of the following control
expressions are valid for an if statement? |
A |
an integer expression |
B |
a Boolean expression |
C |
either A or B |
D |
Neither A nor B |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
106 |
Question |
State true of false. i) We cannot make the function
inline by defining a function outside the class. ii) A member function can be
called by using its name inside another member function of the same class,
this is known as nesting of member function. |
A |
True, True |
B |
True, False |
C |
False, True |
D |
False, False |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
107 |
Question |
What will be the values of x,
m and n after execution of the following statements? Int x, m, n; m=10; n=15;
x= ++m + n++; |
A |
x=25, m=10, n=15 |
B |
x=27, m=10, n=15 |
C |
x=26, m=11, n=16 |
D |
x=27, m=11, n=16 |
Answer |
C |
Marks |
2 |
Unit |
1 |
Id |
108 |
Question |
How many types of
polymorphisms are supported by C++? |
A |
1 |
B |
2 |
C |
3 |
D |
4 |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
109 |
Question |
Which of the following
approach is adapted by C++? |
A |
Top-down |
B |
Bottom-up |
C |
Right-left |
D |
Left-right |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
110 |
Question |
Which of the following is the
correct class of the object cout? |
A |
Iostream |
B |
istream |
C |
Ostream |
D |
Ifstream |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
111 |
Question |
Which of the following
functions are performed by a constructor? |
A |
Construct a new class |
B |
Construct a new object |
C |
Construct a new function |
D |
Initialize objects |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
112 |
Question |
Which of the following ways
are legal to access a class data member using this pointer? |
A |
this->x |
B |
this.x |
C |
*this.x |
D |
*this-x |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
113 |
Question |
Which operator is having right
to left associativity in the following? |
A |
Array subscripting |
B |
Function call |
C |
Addition and subtraction |
D |
Type cast |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
114 |
Question |
Which operator is having the
highest precedence? |
A |
Postfix |
B |
Unary |
C |
Shift |
D |
Equality |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
115 |
Question |
#include <iostream> using namespace std; int main() { int a; a = 5 + 3 * 5; cout <<a; return 0; } |
A |
35 |
B |
20 |
C |
25 |
D |
30 |
Answer |
B |
Marks |
2 |
Unit |
1 |
Id |
116 |
Question |
#include <iostream> using namespace std; main() { double a = 21.09399; float b = 10.20; int c ,d; c = (int) a; d = (int) b; cout <<c <<' '<<d; return 0; } |
A |
20 10 |
B |
10 21 |
C |
21 10 |
D |
None |
Answer |
A |
Marks |
2 |
Unit |
1 |
Id |
117 |
Question |
#include <iostream> using namespace std; int main() { int num1 = 10; float num2 = 20; cout <<sizeof(num1 + num2); return 0; } |
A |
2 |
B |
4 |
C |
8 |
D |
Garbage |
Answer |
B |
Marks |
2 |
Unit |
1 |
Id |
118 |
Question |
#include <stdio.h> using namespace std; int array1[] = {1200, 200, 2300, 1230,
1543}; int array2[] = {12, 14, 16, 18, 20}; int temp, result = 0; int main() { for (temp = 0; temp <5; temp++) { result += array1[temp]; } for (temp = 0; temp <4; temp++) { result += array2[temp]; } cout <<result; return 0; } |
A |
6553 |
B |
6533 |
C |
6522 |
D |
12200 |
Answer |
B |
Marks |
2 |
Unit |
1 |
Id |
119 |
Question |
In procedural programming the
focus in on …........... |
A |
data |
B |
structure |
C |
function |
D |
pointers |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
120 |
Question |
In object oriented programming the focus is on …....... |
A |
data |
B |
structure |
C |
function |
D |
pointers |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
121 |
Question |
Which of the following feature of procedure oriented program is false? |
A |
Makes use of bottom up approach |
B |
Functions share global data |
C |
The most fundamental unit of
program is function |
D |
All of these |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
122 |
Question |
Which of the following feature of object oriented program is false? |
A |
Data and Functions can be added
easily |
B |
Data can be hidden from outside
world |
C |
Object can communicate with each
other |
D |
The focus is on procedures |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
123 |
Question |
C++ was originally developed by …....... |
A |
Donald Knuth |
B |
Bjarne Sroustrups |
C |
Dennis Ritchie |
D |
None of these |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
124 |
Question |
Which of the following approach is adopted in C++? |
A |
Top down |
B |
Bottom up |
C |
Horizontal |
D |
Vertical |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
125 |
Question |
Which feature of C++ contain the concept of super class and subclass? |
A |
Class and object |
B |
Encapsulation |
C |
Abstraction |
D |
Inheritance |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
126 |
Question |
The main intention of using inheritance is …......... |
A |
to help in converting one data
type to other |
B |
to hide the details of base class |
C |
to extend the capabilities of base
class |
D |
to help in modular programming |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
127 |
Question |
If particular software can be used in some other application than the one for which it is created then it reveals …......... |
A |
data binding |
B |
data reusability |
C |
data encapsulation |
D |
none of these |
Answer |
B |
Marks |
1 |
Unit |
1 |
Id |
128 |
Question |
Which of the following data type does not return anything? |
A |
Int |
B |
short |
C |
long |
D |
void |
Answer |
D |
Marks |
1 |
Unit |
1 |
Id |
129 |
Question |
How many objects can be created from an abstract class? |
A |
Zero |
B |
One |
C |
Two |
D |
As many as we want |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
130 |
Question |
Which of the following statements is correct for a
static member function? 1. It can access only other static members of
its class. ·
It can
be called using the class name, instead of objects |
A |
Only 1 is correct |
B |
Only 2 is correct |
C |
Both 1 and 2 are
correct |
D |
Both 1 and 2 are
incorrect |
Answer |
C |
Marks |
1 |
Unit |
1 |
Id |
131 |
Question |
Select the correct statement |
|
I. In procedural programming oriented language all the function calls are |
|
resolved at compile time. |
|
II. In object oriented programming language all function calls are |
|
resolved at compile time. |
A |
Only I |
B |
Only II |
C |
Both I and II |
D |
Neither I nor II |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
132 |
Question |
What happens when a class with
parameterized constructors and having no default constructor is used in a
program and we create an object that needs a zero-argument constructor? |
A |
Compile-time error |
B |
Preprocessing error |
C |
Runtime error |
D |
Runtime exception |
Answer |
A |
Marks |
1 |
Unit |
1 |
Id |
133 |
Question |
Which of the following interface determines how your program will be used
by other program? |
A |
Public |
B |
Private |
C |
Protected |
D |
None of these |
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
134 |
|
Question |
What is the difference between struct and class in C++? |
|
A |
|
|
B |
Members of a class are private
by default and members of struct are public by default. When deriving a struct
from a class/struct, default access-specifier for a base class/struct is
public and when deriving a class, default access specifier is private. |
|
C |
All members of a structure are
public and structures don't have virtual functions |
|
D |
All above |
|
Answer |
B |
|
Marks |
1 |
|
Unit |
I |
Id |
135 |
|
Question |
Predict the output of
following C++ program
|
|
A |
A non zero value |
|
B |
0 |
|
C |
Compile time error |
|
D |
Runtime error |
|
Answer |
A |
|
Marks |
1 |
|
Unit |
I |
Id |
136 |
Question |
class Test { int x;
}; int main() { Test t; cout <<t.x; return 0; } |
A |
0 |
B |
Garbage value |
C |
Compile time error |
D |
|
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
137 |
Question |
Which of the following is true? |
A |
All objects of a class share
all data members of class |
B |
Objects of a class do not
share non-static members. Every object has its own copy |
C |
Objects of a class do not
share codes of non-static methods, they have their own copy |
D |
None |
Answer |
B |
Marks |
1 |
Unit |
I |
Id |
138 |
|
Question |
Assume that an integer and a
pointer each takes 4 bytes. Also, assume that there is no alignment in
objects. Predict the output following program.
|
|
A |
12 4 |
|
B |
12 12 |
|
C |
8 4 |
|
D |
8 8 |
|
Answer |
|
|
Marks |
2 |
|
Unit |
I |
Id |
139 |
|
Question |
Which of the following is true
about the following program
|
|
A |
Compiler Error: Cannot have
two objects with same class name |
|
B |
Compiler Error in Line
"::t.get();" |
|
C |
Compiles and runs fine |
|
D |
|
|
Answer |
C |
|
Marks |
2 |
|
Unit |
I |
Id |
140 |
Question |
How to create a dynamic array of pointers (to integers) of size 10 using
new in C++? Hint: We can create a non-dynamic array using int *arr[10] |
A |
int *arr = new int *[10]; |
B |
int **arr = new int *[10]; |
C |
int *arr = new int [10]; |
D |
Not possible |
Answer |
1 |
Marks |
1 |
Unit |
I |
Id |
141 |
Question |
Which of the following is true about new when compared with malloc. 1)
new is an operator, malloc is a function 2) new calls constructor, malloc
doesn't 3) new returns appropriate pointer, malloc returns void * and pointer
needs to typecast to appropriate type. |
A |
1 and 3 |
B |
2 and 3 |
C |
1 and 2 |
D |
All 1,2,3 |
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
142 |
|
Question |
Predict the output?
|
|
A |
Compile time error |
|
B |
Garbage |
|
C |
0 |
|
D |
5 |
|
Answer |
A |
|
Marks |
2 |
|
Unit |
I |
Id |
143 |
|
Question |
What happens when delete is
used for a NULL pointer?
|
|
A |
Compile time error |
|
B |
Run time error |
|
C |
No effect |
|
D |
|
|
Answer |
C |
|
Marks |
1 |
|
Unit |
I |
Id |
144 |
|
Question |
Is it fine to call delete
twice for a pointer?
|
|
A |
Yes |
|
B |
No |
|
C |
|
|
D |
|
|
Answer |
B |
|
Marks |
1 |
|
Unit |
I |
Id |
145 |
Question |
Which of the followings is/are automatically added to every class, if we
do not write our own. |
A |
Copy constructor |
B |
Assignment operator |
C |
A constructor without any parameter |
D |
All |
Answer |
D |
Marks |
1 |
Unit |
I |
Id |
146 |
Question |
When a copy constructor may be called? |
A |
When an object of the class is
returned by value |
B |
When an object of the class is
passed (to a function) by value as an argument |
C |
When an object is constructed
based on another object of the same class |
D |
All |
Answer |
D |
Marks |
1 |
Unit |
I |
Id |
147 |
|
Question |
Output of following program?
|
|
A |
Compile time error |
|
B |
Run time error |
|
C |
Constructor called |
|
D |
|
|
Answer |
A |
|
Marks |
1 |
|
Unit |
I |
Id |
148 |
Question |
Which of the following interface determines how your program will be used
by other program? |
A |
Public |
B |
Private |
C |
Protected |
D |
None of these |
Answer |
A |
Marks |
1 |
Unit |
I |
Id |
149 |
Question |
#include<iostream> using namespace std; class Point { public: Point()
{ cout <<"Constructor called"; } }; int main() { Point t1,
*t2; return 0; } |
A |
Compiler Error |
B |
Constructor called |
C |
Constructor called |
D |
|
Answer |
C |
Marks |
1 |
Unit |
I |
Id |
150 |
Question |
#include<iostream> using namespace std; class X { public: int x; }; int main() { X a =
{10}; X b =
a; cout
<<a.x <<" " <<b.x; return
0; } |
A |
Compiler Error |
B |
10 followed by Garbage Value |
C |
10 10 |
D |
10 0 |
Answer |
D |
Marks |
1 |
Unit |
I |