Computer

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

Answer
b) It organizes code into functions and procedures

In object-oriented programming (OOP), which of the following is used to represent real-world entities?
a) Variables
b) Objects
c) Functions
d) Loops

Answer
b) Objects

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

Answer
c) Functions as first-class citizens

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

Answer
b) Class

Which of the following programming paradigms emphasizes immutability and pure functions?
a) Procedural programming
b) Object-oriented programming
c) Functional programming
d) Logic programming

Answer
c) Functional 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

Answer
c) Functions and procedures that operate on data

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

Answer
c) Inheritance

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

Answer
c) Functional 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

Answer
c) It organizes code into objects and classes

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

Answer
b) Procedural 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

Answer
a) A function that does not modify any state or variables outside of its scope

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

Answer
b) Class and Object

Which of the following is not a feature of procedural programming?
a) Sequence
b) Iteration
c) Polymorphism
d) Selection

Answer
c) Polymorphism

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

Answer
b) Functions that take other functions as arguments or return them as results

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

Answer
a) To hide the complexity of a system

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

Answer
b) Using an arrow function

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

Answer
c) Object-oriented 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

Answer
b) The ability to use the same method name for different implementations

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

Answer
c) A function that can access variables from its enclosing scope

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

Answer
b) It focuses on functions and procedures to perform tasks

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

Answer
c) It can be harder to maintain as the program grows

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

Answer
a) It avoids side effects by using pure functions

In object-oriented programming, which feature allows creating new classes based on existing classes?
a) Encapsulation
b) Abstraction
c) Inheritance
d) Polymorphism

Answer
c) Inheritance

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

Answer
b) Functional programming emphasizes functions and immutability, while OOP emphasizes objects and classes

Which of the following is not a feature of functional programming?
a) Higher-order functions
b) Immutability
c) Object-oriented concepts
d) Pure functions

Answer
c) Object-oriented concepts

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

Answer
c) It encourages modularity and reusability through inheritance

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

Answer
c) Procedural 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

Answer
a) It treats computation as the evaluation of mathematical functions and avoids changing state

Related Articles

Leave a Reply

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

Back to top button