MCQ Sets

  • Mock Ups
    • Computer Operator
      • 73-01
      • 73-02
      • 73-03
      • 73-04
      • 73-05
      • 73-06
    • Assistant Computer Operator
  • Quiz
    • Computer Fundamentals
    • Operating Systems
    • MS Word
    • MS Excel
    • MS PowerPoint
    • MS Access
    • HTML
  • Sets
    • Computer Fundamentals
    • Operating System
    • Microsoft Word
    • MS Excel
    • MS PowerPoint
    • MS Access
    • HTML & Web Page Designing
    • C++
    • Data Structures & Algorithms
  • Read
    • Tips & Articles
    • Fundamentals
    • MS Word
    • DBMS
    • Operating Systems
    • HTML & Web Page Design
  • Videos
  • Ask
    • Ask MCQ Sets
    • Discussion Forum
  • Downloads
  • Old Question Papers

Solved C++ MCQs Set 01

November 1, 2014 by Suresh Khanal 9 Comments

C++ MCQ Questions

C++ Multiple Choice Questions

1. If the class name is X, what is the type of its “this” pointer (in a nonstatic, non-const member function)?

a. const X* const

b. X* const

c. X*

d. X&

 

2. Which classes allow primitive types to be accessed as objects?

a. Storage

b. Virtual

c. Friend

d. Wrapper

 

3. When is std::bad_alloc exception thrown?

a. When new operator cannot allocate memory

b. When alloc function fails

c. When type requested for new operation is considered bad, thisexception is thrown

d. When delete operator cannot delete the allocated (corrupted) object

 

4. Which one of the following is not a fundamental data type in C++

a. float

b. string

c. int

d. wchar_t

 

5. Which of the following is a valid destructor of the class name “Country”

a. int ~Country()

b. void Country()

c. int ~Country(Country obj)

d. void ~Country()

 

6. Which of the following correctly describes C++ language?

a. Statically typed language

b. Dynamically typed language

c. Both Statically and dynamically typed language

d. Type-less language

 

7. Which of the following keyword supports dynamic method resolution?

a. abstract

b. Virtual

c. Dynamic

d. Typeid

 

8. Which of the following is the most preferred way of throwing and handling exceptions?

a. Throw by value and catch by reference.

b. Throw by reference and catch by reference.

c. Throw by value and catch by value

d. Throw the pointer value and provide catch for the pointer type.

 

9. Which of the following is not true about preprocessor directives

a. They begin with a hash symbol

b. They are processed by a preprocessor

c. They form an integral part of the code

d. They have to end with a semi colon

 

10. What’s wrong? while( (i < 10) && (i > 24))

a. the logical operator && cannot be used in a test condition

b. the while loop is an exit-condition loop

c. the test condition is always false

d. the test condition is always true

 

11. A continue statement causes execution to skip to

a. the return 0; statement

b. the first statement after the loop

c. the statement following the continue statement

d. the next iteration of the loop

 

12. What’s wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);

a. the question mark should be an equal sign

b. the first semicolon should be a colon

c. there are too many variables in the statement

d. the conditional operator is only used with apstrings

 

13. What’s wrong? for (int k = 2, k <=12, k++)

a. the increment should always be ++k

b. the variable must always be the letter i when using a for loop

c. there should be a semicolon at the end of the statement

d. the commas should be semicolons

 

14. Which of the following is not recommended in a header file?

a. Type definitions (typedefs)

b. Class definitions

c. Function definitions

d. Template definitions

 

15. Which of the STL containers store the elements contiguously (in adjacent memory locations)?

a. std::vector

b. std::list

c. std::map

d. std::set

 

16. Which of the following is not a standard exception built in C++.

a. std::bad_creat

b. std::bad_alloc

c. std::bad_cast

d. std::bad_typeid

 

17. What does STL stand for?

a. Simple Template Library

b. Standard Template Library

c. Static Type Library

d. Single Type-based Library

 

18. What is the difference between overloaded functions and overridden functions?

a. Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding

b. Redefining a function in a friend class is called function overriding while Redefining a function in a derived class is called an overloaded function.

c. Overloading is a static or compile-time binding and Overriding is dynamic or run-time binding

d. Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden function.

 

19. Which one of the following is not a valid reserved keyword in C++

a. Explicit

b. Public

c. Implicit

d. Private

 

20. Each pass through a loop is called a/an

a. enumeration

b. iteration

c. culmination

d. pass through

Correct Answers to C++ MCQ Questions

1 – d 2 – b 3 – d 4 – a 5 – b 6 – d 7 – a 8 – b 9 – a 10 – d
11 – c 12 – d 13 – b 14 – d 15 – c 16 – a 17 – b 18 – b 19 – c 20 – c

Thank you Rasel for pointing out the mistake. Answer for Q.No. 17 is updated accordingly.

Please, let us know if you discover any error or mistake in these MCQ sets. Don’t hesitate to leave your comments.

Download MCQ Questions PDF File for C++

Please visit Downloads section to download the pdf file of these MCQs from C++.

Other C++ MCQ Questions

Filed Under: C++ Tagged With: c++, C++ PDF, mcq questions

← Solved C++ MCQs Set 06 Solved C++ MCQs Set 04 →

Comments

  1. Patiwet says

    October 20, 2015 at 11:45 am

    9. Which of the following is not true about preprocessor directives
    a. They begin with a hash symbol (correct)
    b. They are processed by a preprocessor (correct)
    c. They form an integral part of the code (correct)
    d. They have to end with a semi colon (incorrect)

    The answer of number 9 must be d. not a.

    Reply
    • Amir Ali says

      February 3, 2017 at 2:40 pm

      Yes D is correct

      Reply
  2. Patiwet says

    October 20, 2015 at 11:50 am

    The answer of question number 20 is b. not c.

    Reply
  3. c++\\ says

    November 15, 2015 at 5:52 am

    The answer of question number 12 is b. not d.

    Reply
  4. Tahir says

    August 1, 2016 at 11:40 am

    Bullshit So many mistakes in this MCQ.

    Reply
  5. Marwa says

    December 12, 2016 at 9:47 pm

    13. What’s wrong? for (int k = 2, k <=12, k++)

    a. the increment should always be ++k. (correct)

    b. the variable must always be the letter i when using a for loop. (correct)

    c. there should be a semicolon at the end of the statement. (correct)

    d. the commas should be semicolons. (incorrect)
    The answer of number 13 must be d. not b.

    Reply
  6. Ankit Rastogi says

    May 7, 2017 at 1:25 am

    Which of the following is a valid destructor of the class name “Country”

    b. void Country() incorrect

    d. void ~Country(). Correct

    In answer b option is correct why??
    Please Explain

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

User manuals http://manymanuals.com

Published MCQs for:

  • Computer Fundamentals
  • Operating Systems (Basics)
  • Word Processing (MS Word)
  • Spread Sheet (MS Excel)
  • Presentation (MS PowerPoint)
  • DBMS (MS Access)
  • Webpage Designing (HTML)
  • C++ Programming Language
  • Data Structures & Algorithms

Reading Materials for:

Fundamentals of Computers
► Syllabus of Computer Fundamentals
► Introduction to Computer Fundamentals
► History of Computers
► Computer Generations
► Classification of Computers
► Computer System
► Computer Hardware Concept
► Computer Software Concept
► Computer Networking
► Number System

Recent Posts

  • Computer Networks MCQ Questions and Answers with PDF Download
  • Online Quiz MS PowerPoint
  • Solved Question Paper of PSC for NARC 2074-2-18
  • Computer Basics – Solved Question Paper of MPA 2017 (Spring) – Purbanchal University (PU)
  • A simple protocol used for fetching email from a mail box is

MCQ Sets

  • Home
  • About Us
  • Contact Us
  • Privacy Policy
  • User Testimonials
  • Help MCQ Sets Grow More!
  • RSS Feeds
  • Sitemap

Recent Comments

  • Suresh Khanal on The technique which store programs on a disk and then transfer the programme to main memory whenever needed is known as
  • Ajay Rauniyar on Ask MCQ Sets
  • MCQ Questions for MS PowerPoint – Another 100 MCQs » MCQ Sets on Microsoft PowerPoint MCQ Questions – The next 100 MCQs
  • MCQ Questions for MS PowerPoint – Another 100 MCQs » MCQ Sets on MS Office MCQ Questions with Answers [ PowerPoint ] – The first 100 MCQs
  • Suresh Khanal on Solved Question Paper of Computer Operator – Nepal Khadya Sansthan