Prog. in C++

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

Which of the following data types is a collection of different data types referenced under one name?

  1. Enumeration

  2. Union

  3. Structure

  4. None of these


Correct Option: C
Explanation:

Structure is a collection of different data types referenced under one name.

Which of the following is also called 'manipulator' in C++?

  1. endl

  2. const

  3. malloc()

  4. none of these


Correct Option: A
Explanation:

It is a manipulator used to perform line feed in the program. It can be used by including the header file iomanip.h in the beginning of the program.

Which of the following is the exit controlled statement in C++?

  1. For loop

  2. Do-while loop

  3. While loop

  4. None of these


Correct Option: B
Explanation:

This is an exit-controlled loop statement in which the loop statement is executed at least once, even if the condition is false.

Which of the following stream classes supports output functions: put() and write()?

  1. istream

  2. ostream

  3. streambuf

  4. none of these


Correct Option: B
Explanation:

This stream class supports output functions; put() and write().

Which of the following container classes allows the random access iteration permitting direct access to any element?

  1. Deque

  2. List

  3. Set

  4. None of these


Correct Option: A
Explanation:

The deque conatiner class allows random access iteration permitting direct access to any element.

Which of the following members of a class can neither be inherited in public mode nor in private mode?

  1. Protected

  2. Public

  3. Private

  4. None of these


Correct Option: C
Explanation:

Private member of a class can neither be inherited in public mode nor in private mode.

Which of the following methods is used to achieve run-time polymorphism in C++?

  1. Function overloading

  2. Virtual function

  3. Operator overloading

  4. None of these


Correct Option: B
Explanation:

This is the method by which run-time polymorphism can be achieved in which function known at the time of execution, i.e. what operation has to be performed by the type and number of arguments.

Which of the following functions of vector class gives current capacity of the vector?

  1. begin()

  2. clear()

  3. capacity()

  4. none of these


Correct Option: C
Explanation:

This function of vector class gives the current capacity of the vector.

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

  1. '<'

  2. '?:'

  3. '>'

  4. None of these


Correct Option: B
Explanation:

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

Which of the following functions is used to perform operator overloading in C++?

  1. Inline function

  2. Operator function

  3. Virtual function

  4. None of these


Correct Option: B
Explanation:

This is a special function used to perform operator overloading in C++.

Which of the following properties of C++ bounds functions to the code to be executed at compile time?

  1. Dynamic binding

  2. Late binding

  3. Static binding

  4. None of these


Correct Option: C
Explanation:

This is the property of C++ that bounds functions to the code to be executed at compile time.

Which of the following methods is used to give a new name to an existing data type in C++?

  1. typeid

  2. typedef

  3. typename

  4. none of these


Correct Option: B
Explanation:

 This code is used to give a new name to an existing data type in C++.

Which of the following translates the software requirements into specifications for objects, and derives class hierarchies from which the objects can be created?

  1. Object oriented design

  2. Object oriented analysis

  3. Object oriented programming

  4. None of these


Correct Option: A
Explanation:

Object oriented design (OOD) translates the software requirements into specifications for objects and derives class hierarchies from which the objects can be created.

Which of the following menus in visual C++ compiles the source code in the active window and builds an executable file?

  1. View

  2. Build

  3. Tools

  4. Edit


Correct Option: B
Explanation:

This menu compiles the source code in the active window and builds an executable file.

Which of the following storage class specifiers informs the compiler that the variable so declared is defined in another source file?

  1. Auto

  2. Enumeration

  3. Extern

  4. None of these


Correct Option: C
Explanation:

This is an storage class specifier that informs the compiler that the variable so declared is defined in another source file.

Which of the following properties of C++ refers to putting together essential features without including background details?

  1. Inheritance

  2. Polymorphism

  3. Data abstraction

  4. None of these


Correct Option: C
Explanation:

This property of OOP refers to putting together essential features without including background details.

Which of the following functions is used in C++ for the automatic initialization of class objects?

  1. Destructor

  2. Virtual function

  3. Constructor

  4. None of these


Correct Option: C
Explanation:

This function automatically initializes the class objects beacuse they are automatically being called once the object of any class is created.

Which of the following operators has the highest precedence among other operators supported by C++?

  1. &&(logical AND)

  2. +(unary plus)

  3. ==(equal to )

  4. None of these


Correct Option: B
Explanation:

This operator has the highest precedence among other operators as it gives value of the operand.

Which of the following mathematical functions returns tangent of the arguement in radians?

  1. tanh()

  2. sin()

  3. tan()

  4. none of these


Correct Option: C
Explanation:

This function returns tangent of the argument in radians.

Which of the following forms of inheritance occurs when the properties of one class are inherited by more than one class, forming a hierarchy of class?

  1. Multilevel inheritance

  2. Multiple inheritance

  3. Hierarchical inheritance

  4. None of these


Correct Option: C
Explanation:

This is the form of inheritance occurs when the properties of one class are inherited by more than one class forming an hierarchy of class.

We can create infinite loop in C++ by omitting the ______________ expression.

  1. initialization

  2. test

  3. update

  4. none of these


Correct Option: B
Explanation:

This expression is used in loop statement to test the condition and if this statement is omitted, it can lead to infinity condition in the loop.

Which of the following error handling functions returns true when an input or output operation has failed?

  1. eof()

  2. fail()

  3. bad()

  4. none of these


Correct Option: B
Explanation:

This function returns true when an input or output operation has failed.

Which of the following library functions is used in C++ to break out of the program, abandoning the rest of the execution of the program?

  1. break

  2. exit()

  3. go to

  4. none of these


Correct Option: B
Explanation:

This function is used in C++ to break out of the program abondoning the rest of the execution of the program.

Which of the following header files provides a set of manipulator functions to manipulate output formats?

  1. iostream.h

  2. iomanip.h

  3. conio.h

  4. string.h


Correct Option: B
Explanation:

This header file provides a set of manipulator functions to manipulate output formats.

Which of the following 'ios format functions' specifies format flags that can control the form of output display?

  1. width()

  2. precision()

  3. setf()

  4. none of these


Correct Option: C
Explanation:

This function specifies format flags that can control the form of output display.

- Hide questions