QuestionsBank
QuestionsBank
C++ Questions
1. Which of the following is a feature of C++?
A. Object-oriented programming
B. Procedural programming
C. Both A and B
D. None of the above
A. extends
B. :
C. inherits
D. implements
Answer: B. :
A. new
B. malloc
C. alloc
D. create
Answer: A. new
A. // comment
B. /* comment */
C. # comment
D. <!-- comment -->
Answer: A. // comment
A. int
B. string
C. bool
A. Operator overloading
B. Function overloading
C. Method overriding
D. None of the above
8. Which access specifier makes members accessible only within the same class?
A. public
B. private
C. protected
D. internal
Answer: B. private
A. 1
B. 2
C. 4
D. 8
Answer: A. 1
A. Destructor
B. Constructor
C. Overloaded function
D. Main function
Answer: B. Constructor
A. for
B. while
C. do-while
D. foreach
Answer: D. foreach
A. Code reuse
B. Type safety
C. Generic programming
D. All of the above
A. int* ptr;
B. pointer int ptr;
C. int ptr*;
D. ptr int*;
15. Which header file is needed for input and output operations in C++?
A. <iostream>
B. <stdio.h>
C. <stdlib.h>
D. <conio.h>
Answer: A. <iostream>
16. What is the default access specifier for class members in C++?
A. public
B. private
C. protected
D. default
Answer: B. private
A. Initializes an object
B. Cleans up when an object is destroyed
C. Overloads operators
D. Allocates memory
19. Which of the following statements is true about multiple inheritance in C++?
A. It is not supported
B. It allows a class to inherit from more than one class
C. It is the same as multiple interfaces
D. It is only supported in Java
20. Which of the following is the correct way to declare a constant in C++?
A. Encapsulation
B. Inheritance
C. Polymorphism
D. Compilation
Answer: D. Compilation
A. Hiding data
B. Inheriting properties
C. Overloading methods
D. None of the above
A. Overloading
B. Overriding
C. Encapsulation
D. Abstraction
Answer: B. Overriding
C. Overloading methods
D. Overriding functions
Answer: A. Having methods with the same name but different parameters
A. Encapsulation
B. Inheritance
C. Abstraction
D. Polymorphism
Answer: A. Encapsulation
11. Which concept allows objects to be treated as instances of their parent class?
A. Inheritance
B. Polymorphism
C. Encapsulation
D. Abstraction
Answer: B. Polymorphism
A. Initializing an object
B. Cleaning up resources
C. Overriding methods
D. Declaring variables
A. To initialize an object
B. To clean up when an object is destroyed
C. To overload operators
D. To create new objects
A. Java
B. C++
C. C
D. Python
Answer: C. C
A. Singleton
B. Factory
C. Observer
D. Decorator
Answer: A. Singleton
A. Stack
B. Queue
C. Tree
D. Graph
Answer: B. Queue
A. Queue
B. Stack
C. Linked List
D. Array
Answer: B. Stack
A. Bubble Sort
B. Merge Sort
C. Quick Sort
D. Heap Sort
A. O(n)
B. O(n log n)
C. O(n²)
D. O(log n)
A. Queue
B. Stack
C. Array
D. Linked List
Answer: B. Stack
A. Memory usage
B. Algorithm efficiency
C. Code style
D. None of the above
A. A collection of nodes
B. A type of array
8. Which tree traversal method visits the left subtree, then the node, then the right
subtree?
A. Preorder
B. Postorder
C. Inorder
D. Level order
Answer: C. Inorder
A. Stack
B. Queue
C. Tree
D. Graph
Answer: B. Queue
A. Merge Sort
B. Quick Sort
C. Bubble Sort
D. Heap Sort
A. Sorted order
B. Fast lookup
C. Memory efficiency
D. Simple implementation
13. Which algorithm uses the divide and conquer strategy to sort arrays?
A. Bubble Sort
B. Merge Sort
C. Insertion Sort
D. Selection Sort
A. Simple problems
B. Optimization problems with overlapping subproblems
C. Data storage
D. Graph traversal
A. Stack
B. Queue
C. Heap
D. Tree
Answer: C. Heap
17. Which algorithm is best for finding the shortest path in a weighted graph?
A. Dijkstra's Algorithm
B. Depth-First Search
C. Breadth-First Search
D. Kruskal's Algorithm
A. O(n)
B. O(log n)
C. O(n²)
D. O(1)
Answer: B. O(log n)
A. AVL Tree
B. Binary Heap
C. B-tree
D. Graph
A. Queue
B. Stack
C. Array
D. Linked List
Answer: B. Stack
A. Technical skills
B. Communication skills
C. Problem-solving abilities
D. All of the above
A. Casual
B. Business formal
C. Party attire
D. Sportswear
A. Bluff
B. Admit it and explain
C. Change the topic
D. Stay silent
A. Critically
B. Honestly with a focus on improvement
C. Not at all
D. By blaming others
8. What is the purpose of asking 'Where do you see yourself in five years?'
A. To gauge ambition
A. Listening skills
B. Speaking clearly
C. Both A and B
D. None
A. Not important
B. Somewhat important
C. Very important
D. Only if requested
A. Wait silently
B. Follow up with a thank-you email
C. Call repeatedly
D. Immediately ask for feedback
A. Arriving late
B. Overconfidence
C. Being prepared
D. Casual behavior
A. Continuous learning
B. Networking
C. Mentoring
D. All of the above
20. How can you best prepare for unexpected interview questions?
A. Swift
B. Kotlin
C. Objective-C
D. Ruby
Answer: B. Kotlin
A. Swift
B. Java
C. Kotlin
D. Python
Answer: A. Swift
3. What is an SDK?
A. React Native
B. Django
C. Angular
D. Laravel
A. Fast code
B. UI that adapts to different screen sizes
C. Animation speed
D. Memory usage
A. Testing apps
B. Debugging server code
C. Designing graphics
D. None of the above
A. Selenium
B. Appium
C. JUnit
D. Postman
Answer: B. Appium
A. Cookies
B. SQLite database
C. Flat files
D. XML files
A. MVC
B. MVVM
C. MVP
D. All of the above
A. Single codebase
B. Platform-specific features
C. Increased cost
A. Device fragmentation
B. Unlimited memory
C. Single screen resolution
D. None of the above
A. Schedule reminders
B. Design interface
C. Store data
D. Increase app size
17. Which mobile platform uses the App Store for app distribution?
A. Android
B. iOS
C. Windows
D. BlackBerry
Answer: B. iOS
19. Which of the following is crucial for mobile app performance optimization?
A. Structuring content
B. Styling web pages
C. Server-side scripting
D. Database management
A. Style content
B. Add interactivity
C. Store data
D. Handle databases
A. Angular
B. Django
C. Laravel
D. Node.js
Answer: A. Angular
A. PHP
B. HTML
C. CSS
D. JavaScript
Answer: A. PHP
A. Git
B. SVN
C. Mercurial
D. All of the above
A. Ruby
B. JavaScript
C. HTML
D. CSS
Answer: A. Ruby
16. Which of the following is used to design the layout of web pages?
A. CSS
B. HTML
C. JavaScript
D. PHP
Answer: A. CSS
A. MySQL
B. CSS
C. HTML
D. JavaScript
Answer: A. MySQL
A. Rapid development
B. Increased complexity
C. Slower performance
D. None of the above