Menu
Popular Courses
Search

MCQs


Total Questions : 76 | Page 5 of 8 pages
Question 41.

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


  1.    Classes can not have data as public members.
  2.    Structures can not have functions as members
  3.    Class members are public by default.
  4.    None of these.
 Discuss Question
Answer: Option B. -> Structures can not have functions as members



Question 42.

Which of the following is the valid class declaration header for the derived class d with base classes b1 and b2?


  1.    class d : public b1, public b2
  2.    class d : class b1, class b2
  3.    class d : public b1, b2
  4.    class d : b1, b2
 Discuss Question
Answer: Option A. -> class d : public b1, public b2


Question 43.

If we create a file by ‘ifstream’, then the default mode of the file is _________


  1.    ios :: out
  2.    ios :: in
  3.    ios :: app
  4.    ios :: binary
 Discuss Question
Answer: Option B. -> ios :: in



Question 44.

An exception is caused by


  1.    a runtime error.
  2.    a syntax error.
  3.    a problem in the operating system.
  4.    a hardware problem.
 Discuss Question
Answer: Option A. -> a runtime error.


Question 45.

Pure virtual functions


  1.    have to be redefined in the inherited class.
  2.    cannot have public access specification.
  3.    are mandatory for a virtual class.
  4.    None of the above.
 Discuss Question
Answer: Option A. -> have to be redefined in the inherited class.


Question 46.

What will be the result of the expression 13 & 25?


  1.    38
  2.    25
  3.    9
  4.    12
 Discuss Question
Answer: Option C. -> 9



Question 47.

Declaration of a pointer reserves memory space


  1.    for the object.
  2.    for the pointer
  3.    both for the object and the pointer.
  4.    None of these
 Discuss Question
Answer: Option B. -> for the pointer



Question 48.
Function templates can accept
  1.    any type of parameters
  2.    only one parameter
  3.    only parameters of the basic type
  4.    only parameters of the derived type
 Discuss Question
Answer: Option C. -> only parameters of the basic type



Question 49.

Consider the following class definitions:
class a
{
};


class b: protected a
{
};


What happens when we try to compile this class?


  1.    Will not compile because class body of a is not defined.
  2.    Will not compile because class body of b is not defined.
  3.    Will not compile because class a is not public inherited.
  4.    Will compile successfully.
 Discuss Question
Answer: Option D. -> Will compile successfully.



Question 50.

A class defined within another class is:


  1.    Nested class
  2.    Inheritance
  3.    Containership
  4.    Encapsulation
 Discuss Question
Answer: Option A. -> Nested class


Share this page with your friends!

Share this page with your friends!

Latest Videos

Chapter 1 - GLOBAL STEEL SCENARIO & INDI Part 1 : (13-04-2024) INDUSTRY AND COMPANY AWARENESS (ICA)
Direction Sense Test Part 1 Reasoning (Hindi)
Chapter 1 - RMHP / OHP / OB & BP Part 1 : (14-02-2024) GPOE 2024
Cube & Cuboid Part 1 Reasoning (Hindi)
Data Interpretation (DI) Basic Concept Reasoning (Hindi)
Counting Figures Part 1 Counting Of Straight Lines Reasoning (Hindi)
Real Numbers Part 7 Class 10 Maths
Real Numbers Part 1 Class 10 Maths
Polynomials Part 1 Class 10 Maths

Latest Test Papers

Chapter 1.1 : INTRODUCTION Chapter 1 : Raw Material Handling Plant GPOE/GPA 2024
Chapter 1.1 : Personnel Functions- An ov Chapter 1 : Personnel Management GFM 2024
Chapter 3.1 : INTRODUCTION Chapter 3 : Sinter Plant GPOE/GPA 2024
Chapter 2.3 : COAL HANDLING PLANT - Set Chapter 2 : Coke Ovens and Coal Chemicals GPOE/GPA 2024
Chapter 2.1 : Overview Chapter 2 : Materials Management GFM 2024