215
92.6k

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

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Bachelor of Computer Applications (BCA) , Programming Languages .

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

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.