You are on page 1of 29

Q 1 

- C++ does not supports the following


● A - Multilevel inheritance
● B - Hierarchical inheritance
● C - Hybrid inheritance
● D - None of the above.

Q 2 - Choose the respective delete operator usage for the expression ‘ptr=new int[100]’.
● A - delete ptr;
● B - delete ptr[];
● C - delete[] ptr;
● D - []delete ptr;

Q 3 - Operators sizeof and ?:


● A - Both can be overloaded
● B - Both cannot be overloaded
● C - Only sizeof can be overloaded
● D - Only ?: can be overloaded

Q 4 - Designer of C++ programming language.


● A - Charles Babbage
● B - Dennis Ritchie
● C - Brain Kernighan
● D - Bjarne Stroustrup

Q 5 - Which feature of the OOPS gives the concept of reusability?


● A - Abstraction
● B - Encapsulation
● C - Inheritance
● D - None of the above.


Q 6 - (i) ‘ios’ is the base class of ‘istream’
● (ii) All the files are classified into only 2 types. (1) Text Files (2) Binary Files.
● A - Only (i) is true
● B - Only (ii) is true
● C - Both (i) & (ii) are true
● D - Both (i) & (ii) are false

Q 7 - What is the output of the following program?


#include<iostream>
using namespace std;
cout<<"Hello"<<endl;
}
main() {
}
● A - No output
● B - Error, as the function is not called.
● C - Error, as the function is defined without its declaration
● D - Error, as the main() function is left empty
Q 8 - Choose the invalid identifier from the below
● A - Int
● B - bool
● C - DOUBLE
● D - __0__
Q 9 - What is the output of the following program?
#include<iostream>
using namespace std;
main() {
char s[] = "Fine";
*s = 'N';
cout<<s<<endl;
}
● A - Fine
● B - Nine
● C - Compile error
● D - Runtime error

Q 10 - C++ does not supports the following


● A - Multilevel inheritance
● B - Hierarchical inheritance
● C - Hybrid inheritance
● D - None of the above.
Q1 2 - Choose the respective delete operator usage for the expression ‘ptr=new int[100]’.
● A - delete ptr;
● B - delete ptr[];
● C - delete[] ptr;
● D - []delete ptr;
Q13 - Operators sizeof and ?:
● A - Both can be overloaded
● B - Both cannot be overloaded
● C - Only sizeof can be overloaded
● D - Only ?: can be overloaded
Q14 - Designer of C++ programming language.
● A - Charles Babbage
● B - Dennis Ritchie
● C - Brain Kernighan
● D - Bjarne Stroustrup
Q15 - Which feature of the OOPS gives the concept of reusability?
● A - Abstraction
● B - Encapsulation
● C - Inheritance
● D - None of the above.
Q16 - (i) ‘ios’ is the base class of ‘istream’
● (ii) All the files are classified into only 2 types. (1) Text Files (2) Binary Files.
● A - Only (i) is true
● B - Only (ii) is true
● C - Both (i) & (ii) are true
● D - Both (i) & (ii) are false
Q17 - What is the output of the following program?
#include<iostream>
using namespace std;
void f() {
cout<<"Hello"<<endl;
}
main() {}
● A - No output
● B - Error, as the function is not called.
● C - Error, as the function is defined without its declaration
● D - Error, as the main() function is left empty
Q18 - What is the output of the following program?
#include<iostream>
using namespace std;
void swap(int m, int n) {
int x = m;
m = n;
n = x;
}
main() {
int x = 5, y = 3;
swap(x,y);
cout<<x<<" "<<y;
}
● A - 3 5
● B - 5 3
● C - 5 5
● D - Compile error

Q19 - Choose the invalid identifier from the below


● A - Int
● B - bool
● C - DOUBLE
● D - __0__

Q 20 - What is the output of the following program?


#include<iostream>
using namespace std;
main() {
char s[] = "Fine";
*s = 'N';
cout<<s<<endl;
}
● A - Fine
● B - Nine
● C - Compile error
● D - Runtime error

21.Which of the following belongs to the set of character types?


char

wchar_t

 only a

 both a and b
22.What is the output of the following?

#include <iostream>

using namespace std;

int main()

char ch = ‘c’

cout << (int(c) + 1);

return 0;

99 + 1

100

 c + 1

100 + 1
23 .Which of the following cannot be friend?

 Function

 Class

Object

 Operator function
24. What will be the output of this program?

#include <iostream>

using namespace std;

int main()

int a = 8;

cout << “ANDing integer ‘a’ with ‘true’ :” << a && true;

return 0;

ANDing integer ‘a’ with ‘true’ :8

ANDing integer ‘a’ with ‘true’ :0

  ANDing integer ‘a’ with ‘true’ :1

Run time error


25. What is the value of the literal 101?

 a

 c

 B

 A

26. Which of the following statements is correct?

   Base class pointer cannot point to derived class.


   Derived class pointer cannot point to base class.

   Pointer to derived class cannot be created.

   Pointer to base class cannot be created.


27. Which of the following does not come under integer literals?

octal

 binary

 decimal

  hexadecimal

.
28. What are the values of a and b?

int a = false

bool b = 99

 1, true

 1, false

 0, true

 0, false.
29. Which of the following literal integer constants are hexadecimal?

0x1a

024

01100100

hex01100100

30. The value 132.54 can represented using which data type?
 double

void

  int

 boolean
31. What is the range of the unsigned char type?

-127 to 128

 0 to 128

0 to 254

0 to 255
32. Identify the user-defined types from the following?

enumeration

classes

both a and b

 int
33. What is the output for the following program?

#include <iostream>

using namespace std;

int main ()

cout << (3 > 4 && 3 > 1) << endl;

return 0;

}
0 (false)

1 (true)

Error

Compile time error


34. What will be the output of following program?

#include <iostream>

using namespace std;

int main()

cout << ‘112’;

return 0;

 J

 I
35. Which of the following is an abstract data type?

int

double

string

  class
36. Evaluate the following code

(5 > 6 || 4 > 3) && (7 > 8)


 0

 1

 true

not compile
37. What is the output of this program?

#include <iostream>

using namespace std;

int main()

int i = -3;

int k = i % 2;

cout << k;

return 0;

compile time error

-1

implementation defined
38. Which of the following is not a type of constructor?

Copy constructor

Friend constructor

Default constructor

Parameterized constructor
39. cout is a/an __________ .?

operator

 function

object

macro
40. Evaluate the following expression
(false && true) || false || true

 0

false

none of the above


41. Which of the following approach is adapted by C++?

Top-down

Right-left

Bottom-up

Left-right
42. Which concept uses the preincrement?

call by value

call by reference

call by function

queue
43. Which of the following is correct about function overloading?

The types of arguments are different.

The order of argument is different.


The number of argument is same.

 Both A and B.
44. What is the output of this program?

#include <iostream>

using namespace std;

class myclass

public:

int i;

myclass *operator->()

{return this;}

};

int main()

myclass ob;

ob->i = 10;

cout << ob.i << ” ” << ob->i;

return 0;

11 11

10 10

runtime error

error
45. What is the output of this program?

#include <iostream>

using namespace std;

ostream & operator<<(ostream & i, int n)

return i;

int main()

cout << 5 << endl;

cin.get();

return 0;

error

runtime error
46. In C++ ………………… operator is used for Dynamic memory allocation.

Scope resolution

Conditional

New
Membership access

47. Pick out the correct statement.

A friend function may be a member of another class.

A friend function may not be a member of another class.

A friend function may or may not be a member of another class.

None of the above


48. Which constructor will initialize the base class data member??

derrived class

base class

class

None of the above


49. Which of the below statement is correct?

We cannot make an instance of an abstract base class

We can make an instance of an abstract base class

Both a & b

None
50. What is the output of this program?

#include <stdio.h>

using namespace std;

int main()

int x = 5, y = 5;
cout << ++x << --y << endl;

return 0;

55

64

 46

 45

.
51. Which inheritance type is used in the class given below?

class A : public X, public Y

Multilevel inheritance

Hybrid inheritance

Hierarchical Inheritance

 Multiple inheritances

.
52. Which of the following statement is correct?

A constructor is called at the time of declaration of an object.

A constructor is called at the time of use of an object.

A constructor is called at the time of declaration of a class.

A constructor is called at the time of use of a class.


53. Which of the following operator is overloaded for object cout ?
  >>

 <<

 +

54. Which of the following correctly describes overloading of functions?

Virtual polymorphism

 Transient polymorphism

Ad-hoc polymorphism

Pseudo polymorphism
55. What is the output of this program?

#include <stdio.h>

using namespace std;

int main()

int a = 21;

int c ;

c = a++;

cout << c;

return 0;

 20

21
22

23
56. Pick out the correct statement .

Preincrement is faster than postincrement

.  postincrement is faster than preincrement.

Both a & b

None of the above


57. Everything defined at the program scope level (ie. outside functions and classes) is said
to be ……………

local scope

regional scope

global scope

static scope
58. What is the output of the program

#include<iostream.h>

void main()

int n=1;

cout<<endl<<“The numbers are;”<<endl;

do

cout <<n<<“\t”;

n++;
} while (n<=100);

cout <<endl;

Print natural numbers 0 to 99

Print natural numbers 1 to 99

Print natural numbers 0 to 100

Print natural numbers 1 to 100


59. What is the output of this program?

#include <stdio.h>

using namespace std;

int main()

int x = 5, y = 5, z;

x = ++x; y = –y;

z = x++ + y–;

cout << z;

return 0;

11

 10

12
60. Which rule will not affect the friend function?
 private and protected members of a class cannot be accessed from outside

private and protected member can be accessed anywhere

both a & b

 None of the above

61. What should present when throwing a object?

constructor

copy-constructor

 destructor

none of the above


62. What are the things that are inherited from the base class?

Constructor and its destructor

Operators & members

Friend functions

All of the above mentioned


63. What is the output of this program?

#include <iostream>

#include <string>

using namespace std;

int main ()

string str (“steve jobs is legend”);

string::iterator it;
str.erase (str.begin()+ 5, str.end()-7);

cout << str << endl;

return 0;

jobs is

steve legend

steve

legend
64. Where does the exception are handled?

inside the program

outside the regular code

 both a & b

none of the above


65. Operator overloading means?

 making c++ operator works with objects

giving new meaning to existing operator

making new operator

both a & b
66. Which of the following operator can’t be overloaded?

::

 -
 []
67. What is meant by template parameter?

It can be used to pass a type as argument

It can be used to evaluate a type.

It can of no return type

None of the above

68. Which is used to check the error in the block?

try

throw

catch

none of the above


69. What is the validity of template parameters?

 inside that block only

  inside the class

  whole program

any of the above mentioned


70. How to handle the exception in constructor?

We have to throw an exception

We have to return the exception

both a & b

 none of the mentioned


71. What is the output of this program?

#include <iostream>
#include “math.h”

using namespace std;

double MySqrt(double d)

if (d < 0.0)

throw “Cannot take sqrt of negative number”;

return sqrt(d);

int main()

double d = 5;

cout << MySqrt(d) << endl;

2.236

compile time error

cannot take sqrt of negative number


72. What is meant by multiple inheritance?

Deriving a base class from derived class

Deriving a derived class from base class

Deriving a derived class from more than one base class

None of the above


73. What is the output of this program?
#include <iostream>

#include <string>

using namespace std;

int main ()

string str (“Ubuntu”);

cout << str.capacity();

cout << str.max_size();

return 0;

61073741820

51073741820

6 and max size depends on compiler

none of the above


74. Which keyword can be used in template?

class

 typename

  C )   both a & b

  D )   function
75. Which operator is used to declare the destructor?

 #

$
 ~
@
76. Which header file is used to declare the complex number?

complexnum

complex

complexnumber

none of the above

77. Which method do we use to append more than one character at a time?

append

operator+=

concatenation

both a & b
78. How to declare the complex number?

 (3,4)

complex(3,4)

(3,4i)

None of the above


79. What is the output of this program?

#include <iostream>

#include <complex>

using namespace std;

int main()
{

complex<int> i(2, 3);

i = i * 6 / 3;

cout << i;

return 0;

(4, 6)

(2, 3)

 (6, 12)

 None of the above


80. Which of the following statements is NOT valid about operator overloading?

Only existing operators can be overloaded.

Overloaded operator must have at least one operand of its class type.

The overloaded operators follow the syntax rules of the original operator.

None of the above


81. Choose the incorrect statement in terms of Objects.
a) Objects are abstractions of real-world
b) Objects can’t manage themselves
c) Objects encapsulate state and representation information
d) All of the mentioned

82. What encapsulates both data and data manipulation functions ?


a) Object
b) Class
c) Super Class
d) Sub Class

83. Which of the following is a mechanism that allows several objects in an class
hierarchy to have different methods with the same name?
a) Aggregation
b) Polymorphism
c) Inheritance
d) All of the mentioned

84. Inherited object classes are self-contained.


a) True
b) False

85. Which of the following points related to Object-oriented development (OOD) is


true?
a) OOA is concerned with developing an object model of the application domain
b) OOD is concerned with developing an object-oriented system model to
implement requirements
c) All of the mentioned
d) None of the mentioned

86. How is generalization implemented in Object Oriented programming languages?


a) Inheritance
b) Polymorphism
c) Encapsulation
d) Abstract Classes

87. Which of the following is a disadvantage of OOD ?


a) Easier maintenance
b) Objects may be
understood as stand-alone entities
c) Objects are potentially reusable components
d) None of the mentioned
88. Which of the following describes”Is-a-Relationship” ?
a) Aggregation
b) Inheritance
c) Dependency
d) All of the mentioned
89. Object that collects data on request rather than autonomously is known as
a) Active Object
b) Passive Object
c) Multiple instance
d) None of the mentioned
90. Objects are executed
a) sequentially
b) in Parallel
c) sequentially & Parallel
d) none of the mentioned
91. This set of Software Engineering Interview Questions and Answers for
Experienced people focuses on “Object Oriented Software Design – 2”.

92. 1. How many layers are present in the OO design pyramid?


a) three
b) four
c) five
d) one

93. Which of the following early OOD methods incorporates both a “micro development
process” and a “macro development process.” ?
a) Booch method
b) Rumbaugh method
c) Wirfs-Brock method
d) Coad and Yourdon method
94. Grady Booch, James Rumbaugh, and Ivar Jacobson combined the best features of their
individual object-oriented analysis into a new method for object oriented design known
as
a) HTML
b) XML
c) UML
d) SGML
95. A design description of an object is known as a class
a) instance
b) object
c) case
d) both instance and object
96.  Which of the following is conceptually similar to objects?
a) PACKAGE
b) PROC
c) PRIVATE
d) None of the mentioned
97. A design description in OOD includes
a) Protocol Description
b) Implementation Description
c) Type Description
d) both Protocol and Implementation Description
98. Which of the following is not an operation as per OOD algorithms and data structures?
a) operations that manipulate data in some way
b) operations that perform a computation
c) operations that check for syntax errors
d) operations that monitor an object for the occurrence of a controlling event
99. Throughout the OOD process, a software engineer should look for every opportunity for
creating new design process.
a) True
b) False
100. Which of the following is the task of project indicators:
a) help in assessment of status of ongoing project
b) track potential risk
c) help in assessment of status of ongoing project & track potential risk
d) none of the mentioned
101. Which of the following does not affect the software quality and organizational
performance?
a) Market
b) Product
c) Technology
d) People
102. The intent of project metrics is:
a) minimization of development schedule
b) for strategic purposes
c) assessing project quality on ongoing basis
d) minimization of development schedule and assessing project quality on ongoing
basis
103. Which of the following is not a direct measure of SE process?
a) Efficiency
b) Cost
c) Effort Applied
d) All of the mentioned
104. Which of the following is an indirect measure of product?
a) Quality
b) Complexity
c) Reliability
d) All of the Mentioned
105.  In size oriented metrics, metrics are developed based on the ___________________
a) number of Functions
b) number of user inputs
c) number of lines of code
d) amount of memory usage
106. Usability can be measured in terms of:
a) Intellectual skill to learn the system
b) Time required to become moderately efficient in system usage
c) Net increase in productivity
d) All of the mentioned
107. A graphical technique for finding if changes and variation in metrics data are
meaningful is known as
a) DRE (Defect Removal Efficiency)
b) Function points analysis
c) Control Chart
d) All of the mentioned
108. Defects removal efficiency (DRE)depends on:
a) E – errors found before software delivery
b) D – defects found after delivery to user
c) Both E and D
d) Varies with project

You might also like