C++ Language

MCQ questions and answers

  • 4.5/5.0
  • 1k Enrolled
  • All levels
  • Last updated 11/2023
  • English

C++ Language MCQ (55)

1.

What is the basic run time entity in an object-oriented system?

A Class
B Object
C Library function
D Polymorphism

Answer: B

2.

__________ is also known as ADT.

A Object
B Inheritance
C Class
D int

Answer: C

3.

Objects are the variable of the type __________.

A class
B int
C float
D pointer

Answer: A

4.

Encapsulation means the wrapper around__________ and __________.

A function, variable
B variable, operator
C function, data
D class, object

Answer: C

5.

The act of representing an essential features with an including the background details or explanation is called __________.

A Object
B Encapsulation
C Polymorphism
D Abstraction

Answer: D

6.

Which concept provides the code reusability feature?

A Polymorphism
B Inheritance
C Encapsulation
D Class

Answer: B

7.

The object of a one-class can acquire the properties of another class is known as__________.

A inheritance
B abstraction
C dynamic binding
D polymorphism

Answer: A

8.

__________ perform the different operations in the different circumstances are called as operator overloading.

A Variable
B Token
C Operator
D Object

Answer: C

9.

____ binding is also known as late binding.

A super binding
B static binding
C compile-time binding
D Run-time binding

Answer: D

10.

The communication between the objects of a class is known as ______

A compile time binding
B run time binding
C message passing
D call by reference

Answer: C

11.

Which of the following is a insertion operator?

A >>
B <<
C ::
D :

Answer: B

12.

What is the default return type of a main() function?

A int
B void
C float
D char

Answer: A

13.

The main() function always return a value to the __________.

A program
B compiler
C interpretter
D operating system

Answer: D

14.

Which operator is also known as an extraction operator or get from the operator?

A <<
B >>
C [ ]
D ::

Answer: B

15.

Which is the smallest individual unit in the program?

A Identifier
B Constant
C Token
D Varibale

Answer: C

16.

Which operator is used to create an object?

A create
B new
C ::
D malloc()

Answer: B

17.

Which of the following loop statement is known as an exit controlled loop?

A for loop
B while loop
C goto
D do-while loop

Answer: D

18.

Which loop is known as an entry controlled loop?

A for loop
B while loop
C A and B
D do-while loop

Answer: C

19.

Which datatype is used to declared the generic pointer?

A long
B double
C new
D void

Answer: D

20.

In which function, the compiler replace the function call with the corresponding function code?

A friend function
B inline function
C malloc()
D calloc()

Answer: B

21.

__________ function allows the program run faster due to the overhead of the function call and return statement has eliminated.

A inline
B friend
C reference
D virtual

Answer: A

22.

A member declared as __________ is accessible by the member function within the class and other class which is declared by it.

A private
B protected
C public
D none

Answer: B

23.

The object can be created by _______ class.

A Interface
B Abstract
C All of the above
D None of the above

Answer: B

24.

A __________ member of class can not be inherited either in public mode or in private mode.

A public
B protected
C private
D None

Answer: C

25.

Which of the following operator is used to inherit the parent class to the child class?

A >>
B <<
C ?:
D ::

Answer: D

26.

____ keyword can directly access the private and protected data of the class?

A virtual
B friend
C inline
D none

Answer: B

27.

A class can inherit the properties from more than one base class which is known as __________.

A single level inheritance
B multilevel inheritance
C multiple inheritance
D hybrid inheritance

Answer: C

28.

Pointer is a __________ datatype.

A basic
B derived
C empty
D primary

Answer: B

29.

Which keyword is used to represent the current object?

A new
B setw
C this
D super

Answer: C

30.

A ________ function is a special form of member function that is declared within a base class and redefined by a derived class

A member
B calling
C virtual
D static

Answer: C

31.

______ virtual function is a virtual function in C++ for which we need not to write any function definition and only we have to declare it

A basic
B pure
C static
D this

Answer: B

32.

__________ is a sequence of bytes.

A Array
B Pointer
C String
D Stream

Answer: D

33.

Which source stream provides the data to the program is called __________.

A input stream
B output stream
C pipe
D stream

Answer: A

34.

The destination stream that receive __________ from the program is called output stream.

A input
B data
C stream
D output

Answer: D

35.

Which operator is overloaded in the istream class?

A <<
B >>
C ::
D ?:
Answer: B

36.

The << operator is overloaded in the__________ class as an insertion operator.

A Ostream
B istream
C FileData
D Character
Answer: A

37.

_______ member function(s) is/are included into the ios class?

A width()
B fill()
C setf()
D all of the above

Answer: D

38.

Which header file provides a set of manipulator functions to use the output format?

A stdio.h
B iostream.h
C conio.h
D iomanip.h

Answer: D

39.

Which function is used to fill the unused portion of the field in a console I/O operations?

A fill()
B setf()
C unsafe()
D setData()

Answer: A

40.

Which function is used in the console I/O operation to clear the flag?

A clear()
B unsetf()
C unset()
D flush()

Answer: B

41.

_____ function is used to read a whole line of text which ends with a newline character?

A getc()
B gets()
C getline()
D cin

Answer: C

42.

__________ is a collection of related data which is stored in a particular area of the disk.

A file
B array
C stack
D heap

Answer: A

43.

Which function is used to move the GET pointer to the specified location?

A seekg()
B seekp()
C tellg()
D tellp()

Answer: A

44.

Which function is used to move the PUT pointer (output) to the specified location?

A tellg()
B seekg()
C tellp()
D seekp()

Answer: D

45.

tellg() function gives the __________ position of the GET pointer.

A last of the line
B end of the line
C current
D first of the line

Answer: C

46.

Which function is use to get the current position of the PUT pointer?

A seek
B seekg()
C tellg()
D tellp()

Answer: D

47.

In the C++, the I/O system contains the classes like ifstream, ofstream, and fstream to deal with file handling operations, these classes are derived from the __________ classes.

A stream
B fstreamcore
C fstreambase
D iostream

Answer: C

48.

The pure virtual function is also known as _____

A friend function
B abstract function
C final function
D inline function

Answer: B

49.

Which mechanism is used to implement the generic programming?

A template
B file
C stream
D pointer

Answer: A

50.

A specific class created from the template class is known as __________.

A base class
B manipulator
C template class
D containership

Answer: C

51.

The function generate from the function template is called __________.

A static function
B formal function
C member function
D template function

Answer: D

52.

__________ is a peculiar problem which may occur at a runtime.

A Error
B Exception
C Algorithm
D Throw

Answer: B

53.

____ block is used to write the error prone code.

A catch block
B throw
C main
D try block

Answer: D

54.

STL stand for

A Standard Template Library
B Simple Template Library
C Standard Test Library
D Standard Template List

Answer: A

55.

__________ pointer is a generic pointer which can be represented by any type of pointer.

A int
B void
C array
D struct
Answer: B

Video Lectures of C Language

Icon
Icon
Icon

Subscribe to our Newsletter for Newest Course Updates