stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
OOP REVIEWER 2 Flashcards | StudBud
Explore
/
OOP REVIEWER 2
OOP REVIEWER 2
38 terms
·
StudBud Administration
·
1 play
Imported from external platform
Flashcards
38 cards
F
Practice quiz
P
Host live
L
Questions
38
Answers
1
Which of the following is true about abstract classes?
They must be interfaces
They contain only abstract methods
They can be instantiated
They can have both abstract and concrete methods
2
Which of the following is true about method overloading?
It requires @Override annotation
It uses the same method name with different parameters
It must have different method names
It involves a subclass
3
Which Java specification provides ORM in Java EE?
Servlet
JPA
JDBC
Spring
4
What is composition in Java?
A class containing objects of another class
A class using final methods
A class implementing an interface
A class extending another class
5
Which class reads text efficiently line by line?
FileInputStream
BufferedReader
BufferedWriter
DataInputStream
6
What is the function of ResultSet in JDBC?
To execute SQL commands
To format the data
To close the connection
To read results from a query
7
What does the finally block do?
Only executes if exception occurs
Executes always
Only executes on IOException
Skips if no exception
8
Which API is used for connecting Java to databases?
JDBC
JPA
Hibernate
Spring
9
What is required for method overriding?
Method with same signature in subclass
Method with different return types
Static method only
Different method name
10
What is compile-time polymorphism?
Abstract class usage
Interface usage
Method overriding
Method overloading
11
What is the main purpose of Hibernate?
Object-relational mapping
Building UI
Handling HTTP requests
Managing threads
12
What is Apache POI used for?
Image processing
Web development Web development
Microsoft Office document handling
Database queries
13
What is true about interfaces in Java?
They can't be implemented
They can be instantiated
They define a contract with abstract methods
They can contain constructors
14
What is composition in Java?
A class implementing an interface
A class using final methods
A class containing objects of another class
A class implementing an interface
15
What will be the output of the following code?
Compilation error
Runtime error
Animal makes a sound
Dog barks
16
What is method overloading in Java?
Redefining a method in a subclass but different parameter lists
Methods with the same name and body but same lists
Multiple methods with the same name but different parameter lists
Static methods only but different parameter lists
17
What is the purpose of the try block?
To execute code that may throw an exception
To catch exceptions and ignore errors
To ignore errors and execute the code
To finalize resources
18
What is required for method overriding?
Different method name
Static method only
Method with same signature in subclass
Method with different return types
19
Which of the following best describes polymorphism?
Method hiding
Compiling multiple programs
Treating objects as instances of their parent class
Running multiple as instances of their parent class
20
How do you define a custom exception class?
class MyEx extends Exception
class MyEx throws Exception
class MyEx implements Exception
class MyEx extends Throwable
21
What is the purpose of Scanner in File I/O?
To write to a file
To delete files
To read primitive values and strings from input
To rename files
22
What does method overriding allow in Java?
Object hiding
Runtime polymorphism
Compile-time polymorphism
Static behavior
23
Which is an example of runtime polymorphism?
Method overloading
Class instantiation
Field hiding
Method overriding
24
Which method is used to establish a connection to a database?
run()
connect()
execute()
getConnection()
25
What is the function of ResultSet in JDBC?
To format the data
To execute SQL commands
To close the connection
To read results from a query
26
Which is an example of runtime polymorphism?
Method overloading
Field hiding
Method overriding
Class instantiation
27
What does the Spring framework provide?
Manual memory management
Dependency Injection and MVC
Java applets
Database tuning
28
Which of the following represents inheritance?
Object contains other objects
Object overrides toString method
Object inherits methods from a parent
Object has fields
29
Which of the following keywords is used to define an abstract class?
abstract
interface
static
final
30
What does the finally block do?
Executes always
Skips if no exception
Only executes if exception occurs
Only executes on IOException
31
What is required for method overriding?
Method with different return types
Static method only
Method with same signature in subclass
Different method name
32
What does reusability mean in OOP?
Using same variable names
Reusing code via inheritance
Writing same code again
Using interfaces
33
What is the purpose of Scanner in File I/O?
To write to a file and strings from input
To read primitive values and strings from input
To delete files and strings from input
To rename files and strings from input
34
What is compile-time polymorphism?
Method overriding
Abstract class usage
Interface usage
Method overloading
35
What is the function of ResultSet in JDBC?
To execute SQL commands
To format the data
To read results from a query
To close the connection
36
Which class is used to write character data to a file?
FileInputStream
FileWriter
BufferedReader
Scanner
37
What does reusability mean in OOP?
Using interfaces
Writing same code again
Reusing code via inheritance
Using same variable names
38
Which of the following is true about method overloading?
It involves a subclass
It requires @Override annotation
It uses the same method name with different parameters
It must have different method names