WorksheetsSE C OOPCG Unit 1
Total questions: 35
Worksheet time: 12mins
Which of the following best defines a programming paradigm?
A design pattern
A way to structure and write programs
A syntax rule in programming
A data structure used in programs
Which is NOT a primary programming paradigm?
Procedural
Functional
Relational
Logic
Programming paradigms influence the way a programmer…
Thinks about software design
Writes hardware drivers
Designs GUIs only
Formats output data
Which paradigm is based on the concept of procedure calls and step-by-step instructions?
Object-Oriented
Functional
Procedural
Logic
Which programming paradigm is mostly used in Prolog?
Functional
Object-Oriented
Procedural
Logic and Rule-Based
Which of the following languages is predominantly functional?
Java
Haskell
Python
C++
Which paradigm supports the concepts of classes and inheritance?
Procedural
Functional
Object-Oriented
Logic-Based
In a logic-based programming language, computation is performed by…
Evaluating expressions
Calling functions
Making assertions and queries
Creating objects
What is the key motivation for Object-Oriented Programming?
Speed
Reusability and Modularity
Error detection
Low-level hardware access
OOP helps in managing complexity by…
Reducing the number of lines of code
Using only global variables
Encapsulating data and behavior
Removing all comments
What concept in Java serves a similar role to namespaces in other languages like C++?
Classes
Packages
Interfaces
Comments
Which keyword is used to define a class in Java?
define
object
class
method
Which of the following is used to create an object in Java?
object = class();
object obj = new class();
class obj = new class();
ClassName obj = new ClassName();
Data members in a class refer to…
Functions
Variables
Keywords
Classes
Which term refers to functions defined inside a class?
Data members
Modules
Methods
Objects
Encapsulation is achieved using…
Public variables
Constructors
Private variables and public methods
Abstract methods
Data abstraction allows a programmer to…
Write low-level code
Focus on what an object does, not how
Access all internals of the class
Create only static methods
Inheritance allows…
Sharing files
One class to acquire properties of another
Executing multiple threads
None of the above
Which keyword is used to inherit a class in Java?
implements
inherits
extends
override
Polymorphism means…
One name, multiple forms
One object, one behavior
Many classes in one file
Multiple packages
Method overloading is an example of…
Compile-time polymorphism
Runtime polymorphism
Inheritance
Abstraction
Which of the following is true for Java?
Java supports only procedural programming
Java does not support inheritance
Java supports full object-oriented principles
Java lacks encapsulation
The documentation section in a Java program usually contains…
JVM info
Java version
Comments about the program
Import statements
Which keyword is used to define a package in Java?
import
package
class
define
The import keyword in Java is used to…
Import packages and classes
Compile classes
Define variables
Allocate memory
What does JVM stand for?
Java Verified Machine
Java Virtual Machine
Java Value Model
Java Variable Manager
What is the role of the JVM?
Compile source code
Manage package imports
Convert bytecode into machine code
Upload files
Java programs are first compiled into…
Native code
Source code
Bytecode
Executables
What is the extension of a Java compiled file?
.java
.exe
.class
.jre
Which of the following is a valid selection statement in Java?
if
while
for
switch
Which Java statement is used to choose between many options?
loop
switch
select
case-if
What is the default keyword used for in a switch statement?
Start loop
End condition
Execute when no case matches
Skip to the next statement
Which is true about if-else statements?
Only one block can run
All blocks run
It is used for looping
It handles exceptions
A method with the same name in two classes related by inheritance demonstrates…
Method overloading
Static binding
Method overriding
Exception handling
What will be the output of the following Java code?
Animal makes sound
Animal makes sound
Dog barks
Cat meows
Compile-time error due to reassigning reference
Runtime error because of invalid casting
