0% found this document useful (0 votes)
738 views

C++ Question Bank

The document contains 35 multiple choice questions about object-oriented programming and C++. It covers object-oriented programming concepts like classes, objects, encapsulation, inheritance and polymorphism. It also covers C++ programming concepts like data types, variables, operators, functions, arrays, classes, constructors and access specifiers. The questions test knowledge about the basic syntax and features of the C++ language as well as fundamental OOP concepts.

Uploaded by

jimmychief05
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
738 views

C++ Question Bank

The document contains 35 multiple choice questions about object-oriented programming and C++. It covers object-oriented programming concepts like classes, objects, encapsulation, inheritance and polymorphism. It also covers C++ programming concepts like data types, variables, operators, functions, arrays, classes, constructors and access specifiers. The questions test knowledge about the basic syntax and features of the C++ language as well as fundamental OOP concepts.

Uploaded by

jimmychief05
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Q1. Which programming paradigm emphasizes the concept of objects and classes?

a. Procedural Programming

b. Functional Programming

c. Object-Oriented Programming

d. Scripting Programming

Answer: c

Q2. What is a fundamental concept in OOP that represents a blueprint for creating objects?

a. Algorithm

b. Class

c. Function

d. Variable

Answer: b

Q3. What is a key advantage of OOP?

a. Reduced Code Complexity

b. Limited Reusability

c. Limited Encapsulation

d. Sequential Execution

Answer: a

Q4. Which programming language is commonly associated with OOP?

a. C

b. Pascal

c. Java

d. Fortran

Answer: c

Q5. In which domain is OOP commonly applied?

a. Web Development

b. Assembly Language Programming

c. Database Management

d. Network Protocols
Answer: a

Q6. In C++, which category includes words reserved for specific purposes and cannot be used as
identifiers?

a. Tokens

b. Keywords

c. Identifiers

d. Constants

Answer: b

Q7. Which type of constant in C++ is represented by a sequence of characters enclosed in double
quotes?

a. Integer Constant

b. Real Constant

c. Character Constant

d. String Constant

Answer: d

Q8. What does the backslash () represent in backslash constants?

a. Escape Character

b. Division Operator

c. Concatenation Operator

d. Logical OR Operator

Answer: a

Q9. Which feature of C++ allows the combination of data and functions into a single unit?

a. Inheritance

b. Encapsulation

c. Polymorphism

d. Abstraction

Answer: b

Q10. What is the basic structure of a C++ program without using a class?

a. main() function only


b. Class definition only

c. #include statement only

d. main() function and #include statement

Answer: d

Q11. Which step involves translating the C++ source code into machine code?

a. Editing

b. Compiling

c. Linking

d. Executing

Answer: b

Q12. What is used to declare the type of data a variable can hold in C++?

a. Data Identifier

b. Data Type

c. Variable Type

d. Data Declaration

Answer: b

Q13. What are used for displaying output and taking input in C++?

a. cout and cin

b. printf and scanf

c. display and input

d. print and read

Answer: a

Q14. Which data type is used to represent whole numbers in C++?

a. int

b. float

c. char

d. double

Answer: a

Q15. What is used to store and manipulate data in a C++ program?


a. Constants

b. Functions

c. Variables

d. Keywords

Answer: c

Q16. Which is a valid variable name in C++?

a. 123variable

b. _myVariable

c. float-variable

d. break

Answer: b

Q17. What is a value that does not change during the execution of a program called?

a. Variable

b. Constant

c. Identifier

d. Operator

Answer: b

Q18. Which operator is used for explicit type casting in C++?

a. +

b. -

c. *

d. (type)

Answer: d

Q19. When is implicit type casting performed in C++?

a. Automatically by the compiler

b. Manually by the programmer

c. During runtime

d. Only for integer types

Answer: a
Q20. What is used for displaying output to the console in C++?

a. print

b. display

c. cout

d. output

Answer: c

Q21. Which operator is used for division in C++?

a. +

b. -

c. *

d. /

Answer: d

Q22. What determines the order in which operators are evaluated in an expression?

a. Associativity

b. Precedence

c. Priority

d. Order

Answer: b

Q23. Which conditional statement is used for making decisions based on multiple conditions in C++?

a. if

b. switch

c. else

d. while

Answer: b

Q24. Which loop executes a block of code as long as a specified condition is true?

a. for

b. while

c. do...while

d. switch
Answer: b

Q25. Which data structure allows the storage of multiple values of the same type in C++?

a. Variables

b. Arrays

c. Strings

d. Functions

Answer: b

Q26. What type of array has a fixed size and cannot be changed during runtime in C++?

a. Static Array

b. Dynamic Array

c. Multidimensional Array

d. String Array

Answer: a

Q27. What is UML used for in the context of programming?

a. Data Storage

b. Code Compilation

c. Software Design and Visualization

d. Program Execution

Answer: c

Q28. What does UML stand for in the context of programming?

a. Unified Modeling Language

b. Universal Markup Language

c. Unique Modeling Logic

d. Unambiguous Model Locator

Answer: a

Q29. What is the primary purpose of encapsulation in OOP?

a. Code Reusability

b. Data Hiding and Protection

c. Polymorphism
d. Inheritance

Answer: b

Q30. In OOP, what represents the properties of an object?

a. Classes

b. Objects

c. Functions

d. Keywords

Answer: a

Q31. What are functions associated with a class called in OOP?

a. Class Functions

b. Member Functions

c. Object Functions

d. Method Functions

Answer: b

Q32. Where are local variables declared in C++ typically visible?

a. Throughout the entire program

b. Only within the function where they are declared

c. In any function within the same class

d. In any function within the entire program

Answer: b

Q33. What type of constructor is automatically called when an object is created?

a. Default Constructor

b. Parameterized Constructor

c. Copy Constructor

d. Private Constructor

Answer: a

Q34. What are methods that allow reading or accessing the values of private data members in a class?

a. Accessor Methods

b. Mutator Methods
c. Static Methods

d. Private Methods

Answer: a

Q35. What keyword is used to declare a member variable or function as belonging to the class rather
than an instance of the class?

a. static

b. const

c. public

d. private

Answer: a

You might also like