OOPS (C/C++)

Description: C++
Number of Questions: 25
Created by:
Tags: OOPS OOPs
Attempted 0/25 Correct 0 Score 0

Which of the following types of functions in C++ perform an action and have no explicit return value?

  1. Computational functions

  2. Manipulative functions

  3. Procedural functions

  4. None of these


Correct Option: C
Explanation:

These functions perform action and have no explicit return value.

Which of the following conversions is known as user-defined type conversion in C++?

  1. Explicit type conversion

  2. Implicit type conversion

  3. Type promotion conversion

  4. None of these


Correct Option: A
Explanation:

This type of conversion is also called as user-defined type conversion as it is explicitly performed by user.

Which of the following functions is used in C++ to convert its arguments to uppercase letters if the argument is a letter?

  1. isupper()

  2. tolower()

  3. isalnum()

  4. toupper()


Correct Option: D
Explanation:

This function converts its argument to uppercase if the argument is in lowercase.

_____________ are the variables that receive the incoming values in a function.

  1. Actual parameters

  2. Function prototypes

  3. Formal parameters

  4. None of these


Correct Option: C
Explanation:

Formal parameters are the variables that receive the incoming values in a function.

Which of the following operators are used to carry out the comparison among operands in C++?

  1. Arithmetic operators

  2. Logical operators

  3. Bitwise operators

  4. Relational operators


Correct Option: D
Explanation:

These operators are used to carry out the comparisons among two operands.

Which of the following is the correct form of C++ statement using C++ short hands and the C++ statement is x = x+7?

  1. x+7=x

  2. x+=7

  3. x+x=7

  4. None of these


Correct Option: B
Explanation:

This is the correct use of short hand operator to increment the variable on the left-hand side with some particular value.

Which of the following is the conditional operator in C++?

  1. ==

  2. <

  3. ?

  4. None of these


Correct Option: C
Explanation:

The conditional operator is a ternary operator which requires three operands depending upon the condition specified. We also specify values to be assigned to the left-hand variable if the condition is true or false.

Which of the following statements in switch case is optional and, if not present, no action takes place if all matches fail?

  1. Case statement

  2. Default statement

  3. Break statement

  4. None of these


Correct Option: B
Explanation:

The default statement is optional and, if it is missing or not present, no action takes place if all matches fail.

In C++, 'For loop' consists of condition in the ___________ expression.

  1. initialization

  2. update

  3. test

  4. none of these


Correct Option: C
Explanation:

The test expression is an expression whose truth value decides whether the loop-body will be executed or not.

Which of the following is the data type that associates integer constants to names?

  1. Derived data type

  2. Array

  3. Enumeration

  4. None of these


Correct Option: C
Explanation:

Enumeration data type associates integer constants to names.

The process of containing objects of another class in a class is known as

  1. dynamic binding

  2. containership

  3. polymorphism

  4. inheritance


Correct Option: B
Explanation:

The process of containing objects of another class in a class is known as containership.

Which of the following functions is used to find the absolute value of any number given as an argument?

  1. ceil()

  2. floor()

  3. fabs()

  4. none of these


Correct Option: C
Explanation:

This function is used to find the absolute value of value given with the function.

Which of the following data types in C++ shares the same memory location with one or more variables?

  1. Union

  2. Structure

  3. Pointer

  4. None of these


Correct Option: A
Explanation:

Union data type shares same memory location by one or more different variables.

Which of the following variables is used in C++ for assigning alias name to a variable?

  1. Global variable

  2. Reference variable

  3. Local variable

  4. Static variable


Correct Option: B
Explanation:

Reference variable is used in C++ to assign alternate name or alias to existing variable.

Which of the following operators cannot be overloaded in C++?

  1. +

  2. -

  3. sizeof

  4. none of these


Correct Option: C
Explanation:

This operator cannot be overloaded in C++ to perform any additional function.

Which of the following is the pre-processor declarative statement in C++?

  1. #define statement

  2. const statement

  3. enum

  4. none of these


Correct Option: A
Explanation:

This statement is used to declare pre-processor constant statement in C++.

A constructor with arguments is called

  1. copy constructor

  2. parameterized constructor

  3. dynamic constructor

  4. none of these


Correct Option: B
Explanation:

A constructor with arguments is called as parameterized constructor.

____________ is the use of the same functional name to perform different task in C++.

  1. Operator overloading

  2. Function overloading

  3. Inheritance

  4. None of these


Correct Option: B
Explanation:

Function overloading means the use of same function name to perform different tasks.

Which of the following is the looping structure in C++?

  1. If-else statement

  2. Switch statement

  3. While statement

  4. None of these


Correct Option: C
Explanation:

This is the looping structure in C++ which excecutes its body until the condition specified in the while statement becomes false.

The function which is not in the scope of any class is called

  1. inline function

  2. static function

  3. friend function

  4. none of these


Correct Option: C
Explanation:

This is the function which is not in the scope of any class and acts as friend to all classes. 

In which of the following forms of inheritance are base classes declared as 'Virtual'?

  1. Single inheritance

  2. Multi-level inheritance

  3. Multiple inheritance

  4. None of these


Correct Option: C
Explanation:

In multiple inheritance, to avoid duplication of inherited members to the derived class, base classes are declared as 'virtual' base class.

__________ is the scope of variable declared in the outermost block of a function.

  1. Local scope

  2. Function scope

  3. Class scope

  4. None of these


Correct Option: B
Explanation:

Function scope is the scope of variable declared in outermost block of a function.

Which of the following is correct regarding 'Break' and 'Continue' statements that are used in C++?

  1. Both are same

  2. Both allow to exit from the loop

  3. One allows to exit from the loop and another skips the iteration

  4. None of these


Correct Option: C
Explanation:

'Break' statement is used to exit from the loop statement in the program whereas 'Continue' is used to skip the specified iteration from the loop statement.

Which of the following header files has to be included to make use of character function in C++?

  1. iostream.h

  2. ctype.h

  3. string.h

  4. iomanip.h


Correct Option: B
Explanation:

This header file is included to perform character functions like isalnum(), isdigit(), islower() etc. in the program.

Which of the following visibilities in C++ could not be inherited either using public or private derivation?

  1. Protected

  2. Private

  3. Public

  4. None of these


Correct Option: B
Explanation:

Private members of a base class cannot be inheriated either by using public or private derivation.

- Hide questions