Programming Paradigms: Procedural, Object-Oriented & Functional MCQs with Answers
Which of the following is the main characteristic of procedural programming?
a) It uses objects and classes
b) It organizes code into functions and procedures
c) It focuses on the flow of control
d) It uses lambda functions
In object-oriented programming (OOP), which of the following is used to represent real-world entities?
a) Variables
b) Objects
c) Functions
d) Loops
Which of the following is a key principle of functional programming?
a) Emphasis on mutable data
b) Use of global variables
c) Functions as first-class citizens
d) Focus on control flow
In object-oriented programming, which of the following is used to define the structure of an object?
a) Variable
b) Class
c) Method
d) Function
Which of the following programming paradigms emphasizes immutability and pure functions?
a) Procedural programming
b) Object-oriented programming
c) Functional programming
d) Logic programming
Which of the following is a key feature of procedural programming?
a) Encapsulation
b) Inheritance
c) Functions and procedures that operate on data
d) Polymorphism
In object-oriented programming, which principle allows for a child class to inherit properties of a parent class?
a) Abstraction
b) Encapsulation
c) Inheritance
d) Polymorphism
Which of the following programming paradigms allows functions to be passed as arguments and returned as values?
a) Procedural programming
b) Object-oriented programming
c) Functional programming
d) Event-driven programming
Which of the following is true about object-oriented programming (OOP)?
a) It is based on procedures and functions
b) It focuses on dividing tasks into small functions
c) It organizes code into objects and classes
d) It uses loops extensively
Which of the following programming paradigms is best for tasks involving state and data changes?
a) Functional programming
b) Procedural programming
c) Object-oriented programming
d) Logic programming
In functional programming, what does the term “pure function” mean?
a) A function that does not modify any state or variables outside of its scope
b) A function that can be called with any number of parameters
c) A function that produces side effects
d) A function that depends on mutable data
Which of the following is an example of object-oriented programming (OOP) concept?
a) For loop
b) Class and Object
c) Lambda function
d) Recursive function
Which of the following is not a feature of procedural programming?
a) Sequence
b) Iteration
c) Polymorphism
d) Selection
In functional programming, what does “higher-order functions” mean?
a) Functions that call themselves
b) Functions that take other functions as arguments or return them as results
c) Functions that modify variables
d) Functions that operate on mutable data
Which of the following is the main purpose of encapsulation in object-oriented programming?
a) To hide the complexity of a system
b) To allow multiple inheritance
c) To ensure that data is accessible globally
d) To allow for function overloading
Which of the following is an example of functional programming in JavaScript?
a) Using a for loop
b) Using an arrow function
c) Using a class constructor
d) Using the new keyword
Which programming paradigm is most suited for applications that model real-world entities as objects?
a) Procedural programming
b) Functional programming
c) Object-oriented programming
d) Logic programming
What does “polymorphism” mean in object-oriented programming?
a) The ability to inherit properties from another class
b) The ability to use the same method name for different implementations
c) The ability to hide implementation details
d) The ability to define abstract methods
In functional programming, what is a “closure”?
a) A function that modifies global variables
b) A function that takes a parameter of a function type
c) A function that can access variables from its enclosing scope
d) A function that always returns the same value
Which of the following is true about procedural programming?
a) It promotes reusability through inheritance
b) It focuses on functions and procedures to perform tasks
c) It encapsulates data and functions together
d) It uses classes and objects for modeling real-world entities
Which of the following is a drawback of procedural programming?
a) It has poor performance
b) It does not support modularity
c) It can be harder to maintain as the program grows
d) It requires a large amount of memory
Which of the following is a benefit of functional programming?
a) It avoids side effects by using pure functions
b) It relies on the state to manage operations
c) It uses mutable data to perform tasks
d) It is easy to understand for beginners
In object-oriented programming, which feature allows creating new classes based on existing classes?
a) Encapsulation
b) Abstraction
c) Inheritance
d) Polymorphism
What is the key difference between functional programming and object-oriented programming?
a) Functional programming uses classes, while object-oriented programming does not
b) Functional programming emphasizes functions and immutability, while OOP emphasizes objects and classes
c) Object-oriented programming avoids recursion, while functional programming embraces it
d) Functional programming does not support closures, while OOP does
Which of the following is not a feature of functional programming?
a) Higher-order functions
b) Immutability
c) Object-oriented concepts
d) Pure functions
Which of the following is an advantage of object-oriented programming (OOP)?
a) It uses global variables extensively
b) It focuses on functions to manipulate data
c) It encourages modularity and reusability through inheritance
d) It avoids the use of objects and classes
Which programming paradigm is best suited for systems that require step-by-step instructions and procedures?
a) Object-oriented programming
b) Functional programming
c) Procedural programming
d) Event-driven programming
Which of the following best describes functional programming?
a) It treats computation as the evaluation of mathematical functions and avoids changing state
b) It emphasizes class-based abstraction and inheritance
c) It is based on manipulating mutable state
d) It focuses on writing low-level, hardware-specific code