Practice
Resources
Contests
Online IDE
New
Free Mock
Events New Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
logo
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER
/ Interview Guides / C++ MCQ with Answers

C++ MCQ with Answers

Last Updated: Jan 08, 2024
Certificate included
About the Speaker
What will you Learn?
Register Now

C++ is a general-purpose programming language. It was designed and implemented by Bjarne Stroustrup in 1979 at Bell Labs. It runs on a variety of platforms, such as Windows, MacOS, and the various versions of UNIX. C++ is

  • A superset of C
  • Supports data abstraction
  • Supports object-oriented programming
  • Supports generic programming.

Types: Types are fundamental to any program. 

C++ has extensive support for types:

  • Primitive types(characters, integers, floating-point numbers, etc.)- Defined by the language itself.
  • User-defined types - Provides mechanisms that let us define our own data types.

Primitive Types can be divided into two types:

  • Arithmetic Type -
    • Integral Types(Characters, integers, boolean values, etc)
    • Floating-point types(float, double, etc)
  • Void(special type)

Variables: A variable provides us with named storage that our programs can manipulate.
Each variable in C++ has a type. It determines the size and layout of the variable’s memory.
It also determines the range of values that can be stored within that memory along with the set of operations that can be applied to the variable. A simple variable definition consists of:

  • A type specifier.
  • A list of one or more variable names separated by commas, and ends with a semicolon.

Classes and Objects in C++:

  • Class is a description of an object.
  • An object is an instance of a class

Instance member variable: Attributes, data members, field, properties.
Instance member functions: Methods, procedures, actions, operations, services.

Access Specifier: There are three types of access specifiers in class:

  • Private
  • Public
  • Protected

Features of OOPS: There are primarily four pillars of OOPS:

  • Data abstraction: Data hiding
  • Inheritance: Reusability
  • Polymorphism: Object to take many forms
  • Encapsulation: Data hiding

C++ MCQ

1. 

What is an object in c++?

Create a free personalised study plan Create a FREE custom study plan
Get into your dream companies with expert guidance
Get into your dream companies with expert..
Real-Life Problems
Prep for Target Roles
Custom Plan Duration
Flexible Plans
2. 

Identify the incorrect constructor type.

3. 

Identify the logical AND operator.

4. 

Identify the scope resolution operator.

5. 

Identify the size of int datatype in C++.

Explore InterviewBit’s Exclusive Live Events
Explore Exclusive Events
By
No More Events to show!
No More Events to show!
No More Events to show!
No More Events to show!
Certificate included
About the Speaker
What will you Learn?
Register Now
6. 

Identify the storage classes that have global visibility.

7. 

Size of wchat_t is.

Start Your Coding Journey With Tracks Start Your Coding Journey With Tracks
Master Data Structures and Algorithms with our Learning Tracks
Master Data Structures and Algorithms
Topic Buckets
Mock Assessments
Reading Material
Earn a Certificate
8. 

The constants in C++ are also known as?

9. 

Total types of constructors in C++ are?

10. 

Total types of errors in C++.

11. 

Under which pillar of OOPS does base class and derived class relationship come?

12. 

Using which of the following data type can 19.54 be represented?

Discover your path to a   Discover your path to a   Successful Tech Career for FREE! Successful Tech Career!
Answer 4 simple questions & get a career plan tailored for you
Answer 4 simple questions & get a career plan tailored for you
Interview Process
CTC & Designation
Projects on the Job
Referral System
Try It Out
2 Lakh+ Roadmaps Created
13. 

Using which of the following keywords can an exception be generated?

14. 

What does a C++ class hold?

15. 

Identify the format string among the following.

16. 

What is do-while loop also known as?

17. 

What is the ASCII value of ‘\0’ character?

18. 

What is the number of parameters that a default constructor requires?

19. 

When can an inline function be expanded?

20. 

Which of the following data type is supported in C++ but not in C?

21. 

Which of the following functions can be inherited from base class?

22. 

Which of the following is not a type of inheritance?

23. 

Which of the following is the correct identifier?

24. 

Which of the following is “address of operator”?.

25. 

Which of the following loops is best when we know the number of iterations?

26. 

Which of the following types is the language C++?

27. 

Why are comments used?

28. 

Find the output of the following program.

main(){
 char ch[] = “Interviewbit Scaler”; 
 int l = strlen(ch);
 cout << l << endl;
}
29. 

C++ uses which approach?

30. 

Choose the correct default return value of function.

31. 

Choose the correct option which is mandatory in a function.

32. 

Choose the correct subscript operator.

33. 

Choose the option below which is not a member of class.

34. 

Choose the size of the below struct.

Struct{
Int a;
Char b;
Float c;
}
35. 

Choose the type of loop which is guaranteed to execute at-least once?

36. 

Data members and member functions of a class are private by.default. True or False?

37. 

Find the output of the following program.

main(){
 int i = (1, 2, 3);
 cout << i << endl;
}
38. 

Find the output of the following program.

main(){
  int a, b = 10;
  a = 95 / 10;
  cout << a << endl;
}
39. 

Find the output of the following program.

main(){
 int a = 10 / 0;
}
40. 

Find the output of the following program.

main(){
  int a = 10, b, c;
  b  = a++;
  c = a;
  cout << a << “ “ <<b <<” “<< c << endl;
}
41. 

By which of the following can the if-else statement be replaced?

42. 

Find the output of the following program.

main(){
 cout <<  -10 - 10 -10;
}
43. 

Find the output of the following program.

main(){
  Float a = 5;
  switch(a){
     Case 5: cout <<”Interviewbit”;
     Default: cout <<”Scaler”;
  }
}
44. 

goto can be classified into?

45. 

How many times will the print statement be executed?

main(){
  int i = 0;
  label:
  cout << “Interviewbit;
  i++;
  if(i < 3){
    goto label;
  }
}
46. 

How much bytes of memory does void occupy?

47. 

Identify the correct definition of ‘*’ operator in pointer.

48. 

Identify the correct escape sequence used for the new line.

49. 

Identify the correct example for a pre-increment operator.

50. 

Identify the correct extension of the user-defined header file in C++.

51. 

Identify the correct function from which the execution of C++ program starts?

52. 

Identify the correct range of signed char.

53. 

Identify the correct syntax for declaring arrays in C++.

Excel at your interview with Masterclasses Know More
Certificate included
What will you Learn?
Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Graduation Year *
Graduation Year *
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College you graduated from
College/University Name
Job Title
Job Title
Engineering Leadership
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer
Security Leadership
Database Administrator
Data Analyst
Data Engineer
Non Coder
Other
Please verify your phone number
Edit
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Already have an account? Log in
Free Mock Assessment
Instructions from Interviewbit
Start Test