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

QuestionsBank

The document contains a series of multiple-choice questions and answers focused on C++, Object-Oriented Programming (OOP), Data Structures and Algorithms (DSA), and general interview questions. Each section presents questions that cover essential concepts, syntax, and principles relevant to programming and interviews. The content serves as a study guide for individuals preparing for technical interviews.

Uploaded by

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

QuestionsBank

The document contains a series of multiple-choice questions and answers focused on C++, Object-Oriented Programming (OOP), Data Structures and Algorithms (DSA), and general interview questions. Each section presents questions that cover essential concepts, syntax, and principles relevant to programming and interviews. The content serves as a study guide for individuals preparing for technical interviews.

Uploaded by

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

MCQ Interview Questions with Answers

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

Answer: C. Both A and B

2. Which symbol is used for inheritance in C++?

 A. extends
 B. :
 C. inherits
 D. implements

Answer: B. :

3. Which operator is used to allocate memory dynamically in C++?

 A. new
 B. malloc
 C. alloc
 D. create

Answer: A. new

4. What is the correct syntax for a single-line comment in C++?

 A. // comment
 B. /* comment */
 C. # comment
 D. <!-- comment -->

Answer: A. // comment

5. Which of the following is a valid C++ data type?

 A. int
 B. string
 C. bool

 D. All of the above

Answer: D. All of the above

6. What does RAII stand for in C++?

 A. Resource Acquisition Is Initialization


 B. Resource Allocation Is Implementation
 C. Run-time Allocation Is Initialization
 D. None of the above

Answer: A. Resource Acquisition Is Initialization

7. Which of the following is used to overload an operator in C++?

 A. Operator overloading
 B. Function overloading
 C. Method overriding
 D. None of the above

Answer: A. Operator overloading

8. Which access specifier makes members accessible only within the same class?

 A. public
 B. private
 C. protected
 D. internal

Answer: B. private

9. What is the output of sizeof(char) in C++?

 A. 1
 B. 2
 C. 4
 D. 8

Answer: A. 1

10. Which function is automatically called when an object is created?

 A. Destructor
 B. Constructor
 C. Overloaded function
 D. Main function

Answer: B. Constructor

11. What is the use of the 'virtual' keyword in C++?

 A. To create abstract classes


 B. To implement polymorphism
 C. To overload operators
 D. To create static functions

Answer: B. To implement polymorphism

12. Which of the following is NOT a valid C++ loop structure?

 A. for
 B. while
 C. do-while
 D. foreach

Answer: D. foreach

13. What is a template in C++ used for?

 A. Code reuse
 B. Type safety
 C. Generic programming
 D. All of the above

Answer: D. All of the above

14. Which is the correct way to declare a pointer in C++?

 A. int* ptr;
 B. pointer int ptr;
 C. int ptr*;
 D. ptr int*;

Answer: A. int* ptr;

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

17. Which of the following best describes a destructor in C++?

 A. Initializes an object
 B. Cleans up when an object is destroyed
 C. Overloads operators
 D. Allocates memory

Answer: B. Cleans up when an object is destroyed

18. What is exception handling in C++ used for?

 A. To handle errors gracefully


 B. To improve performance
 C. To overload functions
 D. To allocate memory dynamically

Answer: A. To handle errors gracefully

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

Answer: B. It allows a class to inherit from more than one class

20. Which of the following is the correct way to declare a constant in C++?

 A. const int x = 10;


 B. int const x = 10;
 C. Both A and B
 D. constant int x = 10;

Answer: C. Both A and B

OOP Interview Questions


1. Which of the following is NOT considered a pillar of OOP?

 A. Encapsulation

 B. Inheritance
 C. Polymorphism
 D. Compilation

Answer: D. Compilation

2. What does encapsulation refer to in OOP?

 A. Hiding data
 B. Inheriting properties
 C. Overloading methods
 D. None of the above

Answer: A. Hiding data

3. Which concept allows a derived class to have a different implementation of a


method from its base class?

 A. Overloading
 B. Overriding
 C. Encapsulation
 D. Abstraction

Answer: B. Overriding

4. What is an abstract class?

 A. A class that cannot be instantiated


 B. A class with only concrete methods
 C. A class used for procedural programming
 D. None of the above

Answer: A. A class that cannot be instantiated

5. In OOP, what does polymorphism mean?

 A. One interface, many implementations


 B. Many interfaces, one implementation
 C. Only one interface and implementation
 D. None of the above

Answer: A. One interface, many implementations

6. Which of the following best describes inheritance?

 A. Deriving new classes from existing ones


 B. Encapsulating data

 C. Overloading methods
 D. Overriding functions

Answer: A. Deriving new classes from existing ones

7. Which statement about interfaces in OOP is true?

 A. They can contain method implementations


 B. They define a contract that classes can implement
 C. They are the same as abstract classes
 D. They cannot be implemented by multiple classes

Answer: B. They define a contract that classes can implement

8. What is method overloading?

 A. Having methods with the same name but different parameters


 B. Redefining a method in a subclass
 C. Hiding a method from the base class
 D. None of the above

Answer: A. Having methods with the same name but different parameters

9. What is method overriding?

 A. Changing the method signature


 B. Providing a new implementation for a method in a subclass
 C. Creating multiple methods with the same name
 D. None of the above

Answer: B. Providing a new implementation for a method in a subclass

10. Which principle involves restricting access to an object's internal data?

 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

12. What does abstraction in OOP involve?

 A. Hiding the complex implementation details


 B. Exposing all internal workings
 C. Duplicating code
 D. None of the above

Answer: A. Hiding the complex implementation details

13. In OOP, what is a constructor used for?

 A. Initializing an object
 B. Cleaning up resources
 C. Overriding methods
 D. Declaring variables

Answer: A. Initializing an object

14. What is the purpose of a destructor in OOP?

 A. To initialize an object
 B. To clean up when an object is destroyed
 C. To overload operators
 D. To create new objects

Answer: B. To clean up when an object is destroyed

15. Which of the following is NOT an OOP language?

 A. Java
 B. C++
 C. C
 D. Python

Answer: C. C

16. What is multiple inheritance?

 A. Inheriting from multiple classes


 B. Overloading a function multiple times
 C. Having multiple constructors
 D. None of the above

Answer: A. Inheriting from multiple classes

17. What is the role of the 'this' pointer in OOP?

 A. To refer to the current object


 B. To refer to a static member
 C. To initialize a variable
 D. None of the above

Answer: A. To refer to the current object

18. Which concept allows a class to have only one instance?

 A. Singleton
 B. Factory
 C. Observer
 D. Decorator

Answer: A. Singleton

19. What is an interface in OOP?

 A. A blueprint for classes


 B. A concrete implementation
 C. A method to overload functions
 D. None of the above

Answer: A. A blueprint for classes

20. Which of the following best defines encapsulation?

 A. Grouping related variables and functions into a single unit


 B. Allowing unlimited access to an object's data
 C. Removing all methods from a class
 D. None of the above

Answer: A. Grouping related variables and functions into a single unit

DSA Interview Questions


1. Which data structure uses First-In-First-Out (FIFO) principle?

 A. Stack
 B. Queue
 C. Tree
 D. Graph

Answer: B. Queue

2. Which data structure is used for Last-In-First-Out (LIFO) operations?

 A. Queue
 B. Stack
 C. Linked List
 D. Array

Answer: B. Stack

3. Which algorithm is used for sorting by repeatedly swapping adjacent elements?

 A. Bubble Sort
 B. Merge Sort
 C. Quick Sort
 D. Heap Sort

Answer: A. Bubble Sort

4. What is the average time complexity of Quick Sort?

 A. O(n)
 B. O(n log n)
 C. O(n²)
 D. O(log n)

Answer: B. O(n log n)

5. Which data structure is best suited for implementing recursion?

 A. Queue
 B. Stack
 C. Array
 D. Linked List

Answer: B. Stack

6. What does the term 'Big O' notation describe?

 A. Memory usage
 B. Algorithm efficiency
 C. Code style
 D. None of the above

Answer: B. Algorithm efficiency

7. What is a linked list?

 A. A collection of nodes
 B. A type of array

 C. A static data structure


 D. None of the above

Answer: A. A collection of nodes

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

9. Which data structure is typically used in Breadth-First Search (BFS)?

 A. Stack
 B. Queue
 C. Tree
 D. Graph

Answer: B. Queue

10. What is a Binary Search Tree?

 A. A tree with nodes having at most one child


 B. A tree with nodes having at most two children
 C. A tree where left is greater than right
 D. None of the above

Answer: B. A tree with nodes having at most two children

11. Which sorting algorithm has a worst-case time complexity of O(n²)?

 A. Merge Sort
 B. Quick Sort
 C. Bubble Sort
 D. Heap Sort

Answer: C. Bubble Sort

12. What is the main advantage of using a hash table?

 A. Sorted order
 B. Fast lookup
 C. Memory efficiency

 D. Simple implementation

Answer: B. Fast lookup

13. Which algorithm uses the divide and conquer strategy to sort arrays?

 A. Bubble Sort
 B. Merge Sort
 C. Insertion Sort
 D. Selection Sort

Answer: B. Merge Sort

14. What type of problems is dynamic programming best suited for?

 A. Simple problems
 B. Optimization problems with overlapping subproblems
 C. Data storage
 D. Graph traversal

Answer: B. Optimization problems with overlapping subproblems

15. Which data structure is commonly used to implement a priority queue?

 A. Stack
 B. Queue
 C. Heap
 D. Tree

Answer: C. Heap

16. What does DFS stand for?

 A. Data First Search


 B. Depth-First Search
 C. Dynamic Function Sort
 D. None of the above

Answer: B. Depth-First Search

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

Answer: A. Dijkstra's Algorithm

18. What is the time complexity of binary search?

 A. O(n)
 B. O(log n)
 C. O(n²)
 D. O(1)

Answer: B. O(log n)

19. Which of the following is a self-balancing binary search tree?

 A. AVL Tree
 B. Binary Heap
 C. B-tree
 D. Graph

Answer: A. AVL Tree

20. Which data structure is ideal for implementing recursion?

 A. Queue
 B. Stack
 C. Array
 D. Linked List

Answer: B. Stack

Basic General Interview Questions


1. Which of the following is most important in a job interview?

 A. Technical skills
 B. Communication skills
 C. Problem-solving abilities
 D. All of the above

Answer: D. All of the above

2. What is usually the first question in an interview?

 A. Tell me about yourself


 B. What is your greatest weakness?
 C. Why do you want to work here?
 D. Where do you see yourself in 5 years?

Answer: A. Tell me about yourself

3. How should you dress for a professional interview?

 A. Casual
 B. Business formal
 C. Party attire
 D. Sportswear

Answer: B. Business formal

4. What is the best way to prepare for an interview?

 A. Research the company


 B. Practice common questions
 C. Prepare your own questions
 D. All of the above

Answer: D. All of the above

5. What should you do if you don't know the answer to a question?

 A. Bluff
 B. Admit it and explain
 C. Change the topic
 D. Stay silent

Answer: B. Admit it and explain

6. Which of the following is a common interview question?

 A. What is your favorite color?


 B. What are your strengths?
 C. Do you like sports?
 D. What's your hobby?

Answer: B. What are your strengths?

7. How should you describe your weaknesses in an interview?

 A. Critically
 B. Honestly with a focus on improvement
 C. Not at all
 D. By blaming others

Answer: B. Honestly with a focus on improvement

8. What is the purpose of asking 'Where do you see yourself in five years?'

 A. To gauge ambition

 B. To test technical skills


 C. To judge social life
 D. None of the above

Answer: A. To gauge ambition

9. Which of the following is important during an interview?

 A. Listening skills
 B. Speaking clearly
 C. Both A and B
 D. None

Answer: C. Both A and B

10. How important is punctuality for an interview?

 A. Not important
 B. Somewhat important
 C. Very important
 D. Only if requested

Answer: C. Very important

11. What should you do after an interview?

 A. Wait silently
 B. Follow up with a thank-you email
 C. Call repeatedly
 D. Immediately ask for feedback

Answer: B. Follow up with a thank-you email

12. Which of the following is a sign of good professionalism?

 A. Arriving late
 B. Overconfidence
 C. Being prepared
 D. Casual behavior

Answer: C. Being prepared

13. What is a good question to ask the interviewer?

 A. How is performance measured?


 B. What is the salary?
 C. When is the lunch break?

 D. Can I leave early?

Answer: A. How is performance measured?

14. How do you handle stress during an interview?

 A. Stay calm and focused


 B. Panic
 C. Talk too much
 D. Remain silent

Answer: A. Stay calm and focused

15. What is the best way to research a company before an interview?

 A. Use its website


 B. Read news articles
 C. Check social media
 D. All of the above

Answer: D. All of the above

16. How should you prepare your resume?

 A. One page summary


 B. Detailed autobiography
 C. Random details
 D. Irrelevant information

Answer: A. One page summary

17. What is one key aspect of good body language in an interview?

 A. Avoid eye contact


 B. Firm handshake
 C. Slouching
 D. Fidgeting

Answer: B. Firm handshake

18. How should you follow up after an interview?

 A. By sending a thank-you note


 B. By ignoring
 C. By complaining
 D. By asking for a job offer immediately

Answer: A. By sending a thank-you note

19. Which of the following is important for career growth?

 A. Continuous learning
 B. Networking
 C. Mentoring
 D. All of the above

Answer: D. All of the above

20. How can you best prepare for unexpected interview questions?

 A. Practice common questions


 B. Develop a growth mindset
 C. Stay updated with industry trends
 D. All of the above

Answer: D. All of the above

Mobile Development Interview Questions


1. Which programming language is primarily used for Android development?

 A. Swift
 B. Kotlin
 C. Objective-C
 D. Ruby

Answer: B. Kotlin

2. Which programming language is primarily used for iOS development?

 A. Swift
 B. Java
 C. Kotlin
 D. Python

Answer: A. Swift

3. What is an SDK?

 A. Software Development Kit


 B. Software Debugging Kit
 C. System Development Kit
 D. None of the above

Answer: A. Software Development Kit

4. Which framework is used for cross-platform mobile app development?

 A. React Native
 B. Django
 C. Angular
 D. Laravel

Answer: A. React Native

5. What does the term 'responsive design' refer to in mobile development?

 A. Fast code
 B. UI that adapts to different screen sizes
 C. Animation speed
 D. Memory usage

Answer: B. UI that adapts to different screen sizes

6. What is the role of an emulator in mobile development?

 A. Testing apps
 B. Debugging server code
 C. Designing graphics
 D. None of the above

Answer: A. Testing apps

7. Which tool is commonly used for mobile app testing?

 A. Selenium
 B. Appium
 C. JUnit
 D. Postman

Answer: B. Appium

8. What is the purpose of push notifications?

 A. Increase user engagement


 B. Slow down the app
 C. Improve app design
 D. Reduce memory usage

Answer: A. Increase user engagement

9. What is a common method for storing data locally on a mobile device?

 A. Cookies

 B. SQLite database
 C. Flat files
 D. XML files

Answer: B. SQLite database

10. Which of the following is a mobile app architecture pattern?

 A. MVC
 B. MVVM
 C. MVP
 D. All of the above

Answer: D. All of the above

11. What does API stand for?

 A. Application Programming Interface


 B. Application Performance Indicator
 C. Automated Programming Interface
 D. None of the above

Answer: A. Application Programming Interface

12. What is the primary role of a mobile backend?

 A. Handling user interface


 B. Managing data and server logic
 C. Designing graphics
 D. Writing client-side code

Answer: B. Managing data and server logic

13. What is the purpose of unit testing in mobile development?

 A. Validate individual components


 B. Check network speed
 C. Design UI
 D. Manage memory

Answer: A. Validate individual components

14. Which of the following is an advantage of cross-platform mobile development?

 A. Single codebase
 B. Platform-specific features
 C. Increased cost

 D. Limited community support

Answer: A. Single codebase

15. What is a common challenge in mobile development?

 A. Device fragmentation
 B. Unlimited memory
 C. Single screen resolution
 D. None of the above

Answer: A. Device fragmentation

16. What is the use of local notifications?

 A. Schedule reminders
 B. Design interface
 C. Store data
 D. Increase app size

Answer: A. Schedule reminders

17. Which mobile platform uses the App Store for app distribution?

 A. Android
 B. iOS
 C. Windows
 D. BlackBerry

Answer: B. iOS

18. What does the term 'native app' refer to?

 A. An app developed for a specific platform


 B. A web app
 C. A cross-platform app
 D. A hybrid app

Answer: A. An app developed for a specific platform

19. Which of the following is crucial for mobile app performance optimization?

 A. Efficient memory management


 B. Colorful UI
 C. Multiple animations
 D. Heavy graphics

Answer: A. Efficient memory management

20. What is one benefit of mobile app analytics?

 A. Tracking user behavior


 B. Increasing app size
 C. Reducing performance
 D. Decreasing user engagement

Answer: A. Tracking user behavior

Web Development Interview Questions


1. What does HTML stand for?

 A. Hyper Trainer Markup Language


 B. Hyper Text Markup Language
 C. Hyper Text Marketing Language
 D. None of the above

Answer: B. Hyper Text Markup Language

2. What is CSS used for?

 A. Structuring content
 B. Styling web pages
 C. Server-side scripting
 D. Database management

Answer: B. Styling web pages

3. What does JavaScript primarily do on a webpage?

 A. Style content
 B. Add interactivity
 C. Store data
 D. Handle databases

Answer: B. Add interactivity

4. Which of the following is a front-end framework?

 A. Angular
 B. Django
 C. Laravel
 D. Node.js

Answer: A. Angular

5. What is the purpose of a RESTful API?

 A. Designing web pages


 B. Connecting front-end and back-end
 C. Styling websites
 D. Managing servers

Answer: B. Connecting front-end and back-end

6. What is the use of AJAX in web development?

 A. Asynchronous data loading


 B. Synchronous data loading
 C. Styling web pages
 D. Database querying

Answer: A. Asynchronous data loading

7. Which language is used for server-side scripting?

 A. PHP
 B. HTML
 C. CSS
 D. JavaScript

Answer: A. PHP

8. What is responsive web design?

 A. A design that adjusts to different devices


 B. A static design
 C. A design with fixed dimensions
 D. None of the above

Answer: A. A design that adjusts to different devices

9. Which version control system is commonly used in web development?

 A. Git
 B. SVN
 C. Mercurial
 D. All of the above

Answer: D. All of the above

10. What does SEO stand for?

 A. Search Engine Optimization

 B. Software Engineering Optimization


 C. Search Efficiency Operation
 D. None of the above

Answer: A. Search Engine Optimization

11. What is a progressive web app (PWA)?

 A. A web app with native app features


 B. A desktop application
 C. A mobile game
 D. None of the above

Answer: A. A web app with native app features

12. Which of the following is a back-end language?

 A. Ruby
 B. JavaScript
 C. HTML
 D. CSS

Answer: A. Ruby

13. What is the main function of a web server?

 A. Delivering web pages


 B. Styling content
 C. Creating databases
 D. Handling user input

Answer: A. Delivering web pages

14. What is the purpose of the DOM in web development?

 A. To represent the structure of a webpage


 B. To store data
 C. To style web pages
 D. To manage databases

Answer: A. To represent the structure of a webpage

15. What does API stand for?

 A. Application Programming Interface


 B. Applied Programming Interface
 C. Application Performance Indicator

 D. None of the above

Answer: A. Application Programming Interface

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

17. What is the purpose of Bootstrap in web development?

 A. To create responsive web designs


 B. To handle server-side logic
 C. To design databases
 D. To manage user sessions

Answer: A. To create responsive web designs

18. Which of the following is a database management system?

 A. MySQL
 B. CSS
 C. HTML
 D. JavaScript

Answer: A. MySQL

19. What is cross-browser compatibility?

 A. Ensuring a website works on different browsers


 B. Developing for a single browser
 C. A browser extension
 D. None of the above

Answer: A. Ensuring a website works on different browsers

20. What is a key advantage of using web frameworks?

 A. Rapid development
 B. Increased complexity
 C. Slower performance
 D. None of the above

Answer: A. Rapid development

You might also like