200+ Object Oriented Programming with C++ (OOP in C++) Solved MCQs

1.

In object oriented Programming the program is divided into ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐.

A. class
B. object
C. function
D. none of these
Answer» B. object
2.

Which one is the Object Oriented Programming language?

A. Cobol
B. C
C. C++
D. both C & C++
Answer» C. C++
3.

The wrapping up of data and functions into a single unit is called ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐.

A. inheritance
B. encapsulation
C. data hiding
D. polymorphism
Answer» B. encapsulation
4.

The process by which objects of one class acquire the properties of objects of another class is called ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ .

A. abstraction
B. inheritance
C. encapsulation
D. polymorphism
Answer» B. inheritance
5.

In OOP which cocept provides the idea of reusability.

A. inheritance
B. encapsulation
C. data hiding
D. polymorphism
Answer» A. inheritance
6.

The process of making an operator to exhibit different behaviors in different instances is called ‐‐‐ ‐‐.

A. function overloading
B. operator overloading
C. inheritance
D. none of these
Answer» B. operator overloading
7.

The process of making a function to exhibit different behaviors in different instances is called ‐‐‐‐‐.

A. function overloading
B. operator overloading
C. inheritance
D. none of these
Answer» A. function overloading
8.

Objects communicate with one another by using ‐‐‐‐‐‐‐‐‐‐.

A. message passing
B. operator overloading
C. inheritance
D. both a & b
Answer» A. message passing
9.

Through ‐‐‐‐‐‐‐‐ we can eliminate redundant code and extend the use of existing class.

A. inheritance
B. operator overloading
C. encapsulation
D. both a & b
Answer» A. inheritance
10.

The ‐‐‐‐‐‐‐‐‐ principle helps the programmer to build secure programs.

A. operator overloading
B. encapsulation
C. data hiding
D. polymorphism
Answer» C. data hiding
11.

What are the basic run time entities in an object oriented program?

A. objects
B. functions
C. datas
D. none of these
Answer» A. objects
12.

OOPs follows ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ approach during program design.

A. top down
B. bottom ‐up
C. both a & b
D. none of these
Answer» B. bottom ‐up
13.

The technique of Hiding internal details in an object is called‐‐‐‐‐

A. encapsulation
B. functions
C. Abstraction
D. inheritance
Answer» C. Abstraction
14.

classes are ‐‐‐‐‐‐‐‐ datatype.

A. derived
B. user‐defined
C. built‐in
D. both a & c
Answer» B. user‐defined
15.

‐‐‐‐‐‐‐‐‐‐ provides interface between the object’s data and program.

A. object
B. functions
C. class
D. polymorphism
Answer» B. functions
16.

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ refers to the linking of procedure call to the code to be executed in response to the call.

A. polymorphism
B. functions
C. dynamic binding
D. object
Answer» C. dynamic binding
17.

A ‐‐‐‐‐‐‐‐ for an object is a request for execution of a procedure.

A. object
B. functions
C. dynamic binding
D. message
Answer» D. message
18.

The << operator is known as‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐.

A. put to
B. get from
C. insertion
D. both a & c
Answer» D. both a & c
19.

The >> operator is known as‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐.

A. put to
B. get from
C. extraction
D. both b & c
Answer» D. both b & c
20.

‐‐‐‐‐‐‐‐ contains function prototype for the standard input and output functions.

A. iomanip.h
B. iostream.h
C. stdlib.h
D. both a & b
Answer» B. iostream.h
21.

In C++ default return type for all the functions is ‐‐‐‐‐‐‐‐‐.

A. int
B. void
C. float
D. none of these
Answer» A. int
22.

Tne multiple use of input and output operator is called …………….

A. polymorphism
B. inheritance
C. cascading
D. none of these.
Answer» C. cascading
23.

Which of the following is not a feature of OOPs.

A. polymorphism
B. inheritance
C. dynamic binding
D. none of these.
Answer» D. none of these.
24.

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ model is also known as linear sequential model.

A. prototype model
B. waterfall model
C. spiral model
D. none of these
Answer» B. waterfall model
25.

In UML ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ is a collection of things tied together through relationships.

A. things
B. relationships
C. diagrams
D. none of these
Answer» C. diagrams
26.

A ‐‐‐‐‐‐‐‐ is a physical device that exists at run time.

A. node
B. package
C. both a and b
D. none of these
Answer» A. node
27.

Which of the following is a UML relationship.

A. dependency
B. association
C. generalization
D. all of the above
Answer» D. all of the above
28.

Which of the following is a UML constituents

A. things
B. relationships
C. diagrams
D. all of the above
Answer» D. all of the above
29.

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ are conceptual things which exists only during the development process.

A. Package
B. node
C. class
D. none of the above
Answer» A. Package
30.

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ relationship indicates that the change to an independent thing will affect the dependent thing.

A. inheritance
B. dependency
C. association
D. aggregation
Answer» B. dependency
31.

‐‐‐‐‐‐‐ can represent items of varying data types to an item.

A. Class
B. Array
C. Structures
D. Object
Answer» C. Structures
32.

‐‐‐‐‐‐ are the smallest or the atomic elements of a language.

A. Identifiers
B. Literals
C. Keywords
D. Tokens
Answer» D. Tokens
33.

Blanks, tabs, newlines, form feeds and comments are collectively called ‐‐‐‐‐‐‐

A. Blank fields
B. White space
C. Null values
D. Literals
Answer» B. White space
34.

Find the false statement from the following

A. An identifier in C++ is defined as an unlimited sequence of characters.
B. The first character must be an alphabet followed by digits or underscore or alphabets.
C. Identifiers are not case sensitive.
D. You can use both uppercase and lower case alphabets in the same identifier.
Answer» C. Identifiers are not case sensitive.
35.

The instructions, which are used in programming, are called ‐‐‐‐‐‐‐‐

A. Data type
B. Keywords
C. Objects
D. Identifiers
Answer» B. Keywords
36.

‐‐‐‐‐ are the reserved words of the programming language.

A. Tokens
B. Literals
C. Separators
D. Keywords
Answer» D. Keywords
37.

‐‐‐‐‐ refer to the names of variables, functions, arrays, classes, etc.

A. Identifiers
B. Operators
C. Punctuators
D. Manipulators
Answer» A. Identifiers
38.

Write the range of value of the data type ‘char’

A. 0 to 128
B. 0 to 255
C. ‐255 to 255
D. ‐128 to 127
Answer» D. ‐128 to 127
39.

Write the range of value of the data type ‘int’

A. ‐32,768 to 32,767
B. 0 to 65535
C. 0 to 65536
D. 0 to 32768
Answer» A. ‐32,768 to 32,767
40.

The standard ASCII characters have numeric values from ‐‐‐ to ‐‐‐‐

A. 0 to 128
B. 0 to 127
C. 0 to 255
D. 0 to 256
Answer» B. 0 to 127
41.

Identify the data type of the value ‐2567113254L

A. Long integer
B. Integer
C. Short integer
D. Big integer
Answer» A. Long integer
42.

Identify the valid integer from the following:

A. 325.6
B. 255 356UL
C. ‐3658 9586L
D. +324454ul
Answer» D. +324454ul
43.

A ‐‐‐‐‐ is the name of the storage location

A. Identifier
B. Variable
C. Keyword
D. Token
Answer» B. Variable
44.

The operator “>>” is called ‐‐‐‐‐

A. Extraction operator
B. Insertion operator
C. Put to operator
D. Printing operator
Answer» A. Extraction operator
45.

Array indexing always starts with the number

A. 0
B. 1
C. 2
D. \0
Answer» A. 0
46.

We declare a function with ______ if it does not have any return type

A. long
B. double
C. void
D. int
Answer» C. void
47.

Which of the following is selection statement in C++?

A. Break
B. goto
C. exit
D. switch
Answer» D. switch
48.

There is a unique function in C++ program by where all C++ programs start their execution

A. start()
B. begin()
C. main()
D. output()
Answer» C. main()
49.

A block comment can be written by

A. Starting every line with double slashes (//)
B. Starting with /* and ending with */
C. Starting with //* and ending with *//
D. Starting with <!‐ and ending with ‐!>
Answer» B. Starting with /* and ending with */
50.

Which of the following is a correct comment?

A. */ Comments */
B. ** Comment **
C. /* Comment */
D. { Comment }
Answer» C. /* Comment */
51.

Which of the following is not a correct variable type?

A. Float
B. Real
C. Int
D. double
Answer» B. Real
52.

A variable is/are

A. String that varies during program execution
B. A portion of memory to store a determined value
C. Those numbers that are frequently required in programs
D. None of these
Answer» B. A portion of memory to store a determined value
53.

By default, the members of a C++ class are:

A. Private
B. Public
C. Protected
D. None of these
Answer» A. Private
54.

Which of the following function that must contain in all C++ Programs

A. start()
B. system()
C. main()
D. program()
Answer» C. main()
55.

Which one of the following is the correct operator to compare two values

A. :=
B. =
C. Equal
D. = =
Answer» D. = =
56.

C++ is originally developed by

A. Nicolas Wirth
B. Dennis Ritchi
C. Bjarne Stroustrup
D. Ken Thompson
Answer» C. Bjarne Stroustrup
57.

The operator ‘<< ‘is called

A. Get from operator
B. Put to operator
C. Extraction operator
D. None of these
Answer» B. Put to operator
58.

Identify the unary operator.

A. ? , :
B. ++
C. +
D. %
Answer» B. ++
59.

The ‐‐‐‐‐‐‐ are used to check the relationship between two numeric operands or expressions.

A. Logical operators
B. Relational operators
C. Arithmetic operators
D. Bitwise operators
Answer» B. Relational operators
60.

To increase the value of c by one which of the following statement is wrong?

A. c++;
B. c = c + 1;
C. c + 1 => c;
D. c += 1
Answer» C. c + 1 => c;
61.

In an assignment statement a=b Which of the following statement is true?

A. The variable a and the variable b are equal.
B. The value of b is assigned to variable a but the later changes on variable b will not affect the value of variable a
C. The value of b is assigned to variable a and the later changes on variable b will affect the value of variable a
D. The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.
Answer» B. The value of b is assigned to variable a but the later changes on variable b will not affect the value of variable a
62.

The continue statement

A. resumes the program if it is hanged
B. resumes the program if it was break was applied
C. skips the rest of the loop in current iteration
D. all of above
Answer» C. skips the rest of the loop in current iteration
63.

Find out the error in following block of code. If (x = 100) Cout << “x is 100”;

A. 100 should be enclosed in quotations
B. There is no semicolon at the end of first line
C. Equals to operator mistake
D. Variable x should not be inside quotation
Answer» C. Equals to operator mistake
64.

What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?

A. 10
B. 9
C. 0
D. 1
Answer» A. 10
65.

When following piece of code is executed, what happens?b = 3; a = b++;

A. a contains 3 and b contains 4
B. a contains 4 and b contains 4
C. a contains 4 and b contains 3
D. a contains 3 and b contains 3
Answer» A. a contains 3 and b contains 4
66.

In case of arguments passed by values when calling a function such as z=addidion(x,y),

A. Any modifications to the variables x & y from inside the function will not have any effect outside the function.
B. The variables x and y will be updated when any modification is done in the function
C. The variables x and y are passed to the function addition
D. None of above are valid.
Answer» A. Any modifications to the variables x & y from inside the function will not have any effect outside the function.
67.

How many times is a do while loop guaranteed to loop?

A. 0
B. Infinitely
C. 1
D. variable
Answer» C. 1
68.

Which of the following is not a valid relational operator?

A. ==
B. =>
C. >=
D. >=
Answer» B. =>
69.

The result of a Relational operation is always

A. either True or False
B. is less than or is more than
C. is equal or less or more
D. All of these
Answer» A. either True or False
70.

A ‐‐‐‐‐‐‐‐ is a memory portion of memory to store a determined value.

A. Constant
B. Variable
C. Keyword
D. Separators
Answer» B. Variable
71.

An identifier may ‐‐‐‐‐‐‐‐

A. Strings, that varies at program execution.
B. Those numbers, that is frequently required in programs.
C. The name of a variable.
D. None of these
Answer» C. The name of a variable.
72.

The visibility of variables inside a structure is

A. Private
B. Public
C. Protected
D. None of these
Answer» B. Public
73.

‐‐‐‐‐‐‐ are used for comparing two conditions or to write a compound condition.

A. Relational operators
B. Ternary operator
C. Conditional operator
D. Logical operator
Answer» D. Logical operator
74.

‐‐‐‐‐ statement is used to print a blank line in CPP program

A. “\n”
B. endl
C. Both ‘a’ and ‘b’
D. None of these
Answer» C. Both ‘a’ and ‘b’
75.

int d=int (a) + int (b);This statement is an example of ‐‐‐‐‐‐‐

A. Implicit conversion
B. Explicit conversion
C. Internal conversion
D. External conversion
Answer» B. Explicit conversion
76.

Within a switch statement

A. Continue can be used but Break cannot be used
B. Continue cannot be used but Break can be used
C. Both Continue and Break can be used
D. Neither Continue nor Break can be used
Answer» B. Continue cannot be used but Break can be used
77.

Strings are character arrays. The last index of it contains the null‐terminated character

A. \n
B. \t
C. \0
D. \1
Answer» C. \0
78.

Observe following function declaration and choose the best Ans:: int divide ( int a, int b = 2 )

A. Variable b is of integer type and will always have value 2
B. Variable a and b are of int type and the initial value of both variables is 2
C. Variable b is international scope and will have value 2
D. Variable b will have value 2 if not specified when calling function
Answer» D. Variable b will have value 2 if not specified when calling function
79.

Arguments of a functions are separated with

A. comma (,)
B. semicolon (;)
C. colon (:)
D. None of these
Answer» A. comma (,)
80.

Variables inside parenthesis of functions declarations have _____ level access.

A. Local
B. Global
C. Module
D. Universal
Answer» A. Local
81.

‐‐‐‐‐‐‐‐‐‐‐ Statement used to branch unconditionally from one point to another in the program.

A. Jump
B. goto
C. break
D. exit(0)
Answer» B. goto
82.

A white space is :

A. blank space
B. new line
C. tab
D. all of the above
Answer» D. all of the above
83.

Which of the following statements are true in c++?

A. Classes cannot have data as public members.
B. Structures cannot have functions as members.
C. Structures cannot have functions as members.
D. None of these.
Answer» B. Structures cannot have functions as members.
84.

What will be the values of x, m and n after the 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=26, m=11, n=16
C. x=27, m=11, n=16
D. x=27, m=10, n=15
Answer» B. x=26, m=11, n=16
85.

Consider the following statements: int x = 22,y=15; x = (x>y) ? (x+y) : (x‐y); What will be the value of x after executing these statements?

A. 22
B. 37
C. 7
D. Error. Cannot be executed
Answer» B. 37
86.

‐‐‐‐‐‐‐ is the actual body of the function

A. Library function
B. Function call
C. Function definition
D. Function declaration
Answer» C. Function definition
87.

Which of the following is an exit controlled loop?

A. While
B. For
C. Switch
D. do…. While
Answer» D. do…. While
88.

‐‐‐‐‐ is a function that is expanded in line when it is invoked.

A. Library function
B. User defined function
C. Inline function
D. None of these
Answer» C. Inline function
89.

The qualifier ‐‐‐‐‐‐ tells the compiler that the function should not modify the argument.

A. Const
B. Static
C. Constant
D. Inline
Answer» A. Const
90.

‐‐‐‐‐‐ refers to the use of the same thing for different purpose.

A. Function declaration
B. Overloading
C. Function calling
D. Prototyping
Answer» B. Overloading
91.

The functions declared inside the class is known as ‐‐‐‐‐‐‐‐

A. Data members
B. Library functions
C. Member functions
D. User defined functions
Answer» C. Member functions
92.

The binding of data and functions together into a single class‐type is referred to as ‐‐‐‐‐‐‐‐

A. Abstraction
B. Encapsulation
C. Inheritance
D. Polymorphism
Answer» B. Encapsulation
93.

When a function is defined inside a class,it is treated as ‐‐‐‐‐‐‐

A. Inline function
B. Inside definition
C. Inline definition
D. Data function
Answer» A. Inline function
94.

Calling a member function by using its name from another member function of the same class is known as ‐‐‐‐‐‐

A. Grouping of member function
B. Member function group
C. Nesting of member function
D. Nested group of member function
Answer» C. Nesting of member function
95.

‐‐‐‐‐ function can only be called by another function that is a member of its class.

A. Member function
B. Private member function
C. Nested member function
D. Public member function
Answer» B. Private member function
96.

‐‐‐‐‐‐‐‐ are normally used to maintain values common to the entire class.

A. Dynamic variables
B. Static variables
C. Private variables
D. Public variables
Answer» B. Static variables
97.

A static variable is initialized to ‐‐‐‐‐when the first object of its class is created.

A. 1
B. Null
C. 0
D. None of these
Answer» C. 0
98.

The same function name having different tasks

A. Function overloading
B. Constructor overloading
C. Polymorphism
D. Operator overloading
Answer» A. Function overloading
99.

The main function having argument

A. Default Argument
B. Command line argument
C. Const argument
D. Constructor overloading
Answer» B. Command line argument
100.

A function calling itself

A. Inline function
B. Static function
C. Friend function
D. Recursion
Answer» D. Recursion
Tags
Question and answers in Object Oriented Programming with C++ (OOP in C++), Object Oriented Programming with C++ (OOP in C++) multiple choice questions and answers, Object Oriented Programming with C++ (OOP in C++) Important MCQs, Solved MCQs for Object Oriented Programming with C++ (OOP in C++), Object Oriented Programming with C++ (OOP in C++) MCQs with answers PDF download