Exam Prep S.E.
What do anonymous classes represent in Java?
Classes defined inside other classes that cannot be instantiated
Classes defined inside methods or blocks from methods that are only visible locally
Classes defined inside other classes and do not have a certain name
Classes that dissapear after the program compiles the first time
What is the main difference between AWT and Swing in Java?
AWT is faster than Swing
Swing offers a richer set of graphical components
Swing is not Java-compatible
AWT is easier to learn than Swing
What is the use of the setContentPane() method in Java Swing?
Sets the window dimensions
Adds a container in a window
Sets the main content of a window
Activates click events
What is the role of the wait() method?
Awaits a notification from another execution thread
Prints the message "I was notified"
Enters an infinite loop
Waits for 2 seconds
Which of the following mechanisms are used to synchronize threads of execution in Java?
Wait/notify
Synchronized
Join
Sleep
Which of the following methods is used to add a component to a container in Java Swing?
AppendComponent(component);
Add(component);
AddComponent(component);
InsertComponent(component);
What in an enum in Java?
A type of data used for simplifying constant declaration
A type of class that cannot be instantiated
A type of variable used to store email adresses
A name by which we refer to arrays that count certain elements
What is serialization in Java?
A process of converting an object into a byte flux used to save and send objects
A process of converting a data type in another data type used for manipulating values
A process of encryption for data in Java
A process through which you give your program a unique serial number
What is the difference between abstract methods and final methods in Java?
Abstract methods cannot be overwritten, while final methods cannot be accesed from other classes.
Abstract methods do not have implementations, while final methods cannot be overwritten
Abstract methods are only used in abstract classes, while final methods are only used in final classes
Abstract and final methods do not have any differences
What is an abstract class in Java?
A class that cannot be instantiated
A class that cannot be inherited
A class that cannot have other methods
An instance of an interface
What is an interface in Java?
An abstract class
A collection of variables
A collection of abstract methods
A collection of objects
What is polymorphism in Java?
The ability to create new objects from existing objects
The ability to extend the functionality of an existing class
The ability to split a class into multiple parts
The ability to use the same method in multiple different classes
What is inheritance in Java?
The ability to create new objects from existing objects
The ability to extend the functionality of an existing class
The ability to split a class into multiple parts
The ability to create a collection of similar objects
What is an object in Java?
An instance of a class
A primitive data type
A collection of methods
A collection of variables
What is a class in Java?
A primitive data type
A method used for creating objects
A collection of similar objects
A template for creating objects
What do exceptions represent in Java?
The mechanism used for treating errors while the program is being executed
Events generated and solved while compiling the programs
Special classes used for managing object collections
Events generated by the operating system
What does the List class represent in Java Collection Framework?
An element collection that does not allow duplicates
An element collection that allows duplicates
A key-value pair collection
A collection of ordered elements
What do synchronous and asynchronous messages represent in a sequence diagram?
Synchronous messages - messages that wait for a response; asynchronous messages - messages that do not wait for a response
Synchronous messages - messages that do not wait for a response; asynchronous messages - messages that wait for a response
Synchronous messages - messages sent between the same object; asynchronous messages - messages sent between different objects
Synchronous messages - messages that can only be sent between objects of the same class; asynchronous messages - messages sent between objects of different classes
Which is the distinctive characteristic of a Map?
Contains ordered elements
Does not allow duplicate values
Stocks pair of type key-value
Implements a stack-type structure
What happens after a Java program throws an exception?
The program continues to run normally
The execution of the program is stopped and it shows an error message
It shows an error message, but the execution of the program continues
A certain action defined in the "Catch" block happens

What is the meaning of the following relationship in the UML diagram? (A and B are classes)
Composition (B has an attribute of type A)
A extends B
Aggregation (A has an attribute of type B)
Association (B has an attribute of type A)

What is the meaning of the following relationship in the UML diagram? (A and B are classes)
Association ( A has an attribute of type B)
A extends B
Aggregation (B has an attribute of type A)
Composition (A has an attribute of type B)

What is the meaning of the following relationship in the UML diagram? (A and B are classes)
A depends on B
A extends B
B implements A
Aggregation (A has an attribute of type B)
What is the purpose of using buffers in input/output streams?
Reduce unnecessary network traffic
Increase the efficiency of reading and writing data
Allow working with encrypted files
Eliminate the need for try-catch blocks in exception handling code
What is the role of a layout manager in graphical interfaces in Java?
Managing the arrangement of graphical components on the page
Validating and processing user inputs
Displaying user data
All of the above
Which of the following classes is used for event handling in Java Swing?
ActionListener
MouseEvent
KeyListener
All of the above
What is the library used for working with graphical interfaces in Java?
Java FX
AWT
Swing
All of the above
What are the basic elements of an activity diagram?
End point
Threads of execution
Decision and junction point
Start point
Timed Signals
Send/receive signals
What is the main purpose of the Model-View-Controller (MVC) in graphic interfaces?
Separation of concerns and flexible coupling of components
Displaying user data
Processing user inputs
All of the above
The keyword volatile is used to
Ensure that variables cannot be accessed in multiple threads
Ensure that shared variables are consistenly updated by multiple threads
Create variables that are lightweight
Create lightweight classes
The keyword synchronized is used to:
Implement mutual exclusion
Ensure that a method is executed simultaneously on multiple threads
Create synchronous variables
Ensure that two Java applications start at the same time
What method from class Thread should be overriden in order to implement the logic of a new thread?
Start();
Run();
Runtime();
Synchronized();
What is ObjectOutputStream used for?
To serialize objects
To deserialize objects
To read from text file
To write into text files
What type of exception is ArrayIndexOutOfBoundsException?
Unchecked (runtime) exception
Checked (compile time) exception
Error
Random exception
What type of Map stores the objects in the order in which they are inserted?
HashMap
LinkedHashMap
TreeMap
AdditionOrderedMap
What is the design pattern prototype used for?
To ensure a class cannot be extended
To ensure a class cannot be instantiated
To ensure a class can be instantiated only once
To clone existing objects when objects creation is expensive
What is the design pattern Factory used for?
It is used to instantiate classes that have lots of attributes
It is used to instantiate classes that have a single attribute
It is used in industrial Java applications
It is used to hide the complex creation factor from client code
What is the meaning of the keyword void in Java?
The method has no parameter
The method doesn't return anything
The method returns null
The method returns 0
Which of the following are the main Java stream categories?
Image streams
Byte streams
Character streams
Number streams
Consider two String variables a and b. How do you correctly verify that their values are equal in Java?
A.equals(b);
A=b;
A===b;
A.eq(b);
How do you correctly declare and instantiate an array of 10 integers in Java?
int [10];
Int[] v = new int[10];
Int[] v = new int[9];
Int[] v;
Which of the following are techniques used for code reuse?
Aggregation.
Inheritance.
Composition.
Polymorphism.
What is the role of the word "this"?
Refers to the current object
Declares a class variable
Refers to the constructor of the base class
Helps access the common interface of objects
What is the role of the word "super"?
Refers to the current object
Allows referencing members from the base class
Is used to declare super-classes
Helps access the common interface of objects
What do you understand by method overloading?
A sequence of code that forces the processor
Multiple methods with the same name and different parameter lists
Forced modification of static variables
Modifying an inherited method
The final keyword is used for:
Declaring volatile variables
Declaring constants
Declaring classes that cannot be extended (inherited)
Declaring methods that cannot be overridden
The static keyword is used for:
Declaring instance members
Declaring class members
A static member cannot be modified
A static variable is not collected by the garbage collector
Consider the following code sequence: int[] arr = {1, 2, 3, 4}; System.out.println(arr[1]); In the console, the output will be:
1
2
3
4
An asbtract class can have:
Only methods with implementation
Only methods without implementation
Both methods with implementation and methods without implementation
Cannot have methods, only abstract attributes
Starting with Java 8, an interface can have:
Only methods with implementation
Only methods without implementation
Both methods with implementation and methods without implementation
There are no interfaces in Java
Which of the following blocks is always executed, regardless of whether an exception is thrown or not?
Try
Catch
Throw
Finally
Where is a method declared in an interface visible by default (without any access specifier)?
Only inside the interface (private)
In all classes from all packages (public)
Only in the current package (package)
Only in the current package and in the classes that implement the interface
In which category of design patterns does Singleton belong?
Creational
Structural
Behavioral
Thread-safe
Which design pattern is used mostly in the context of graphical interfaces?
Singleton
Factory
Model-View-Controller
Prototype
Which type of exceptions does not require mandatory handling (try-catch OR throws) to compile Java code?
Runtime exceptions
Compile-time exceptions
Explicit handling of all exceptions is mandatory
No exception handling is mandatory to compile a Java application
{"name":"Exam Prep S.E.", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"What do anonymous classes represent in Java?, What is the main difference between AWT and Swing in Java?, What is the use of the setContentPane() method in Java Swing?","img":"https://www.quiz-maker.com/3012/CDN/102-5025531/image-2024-06-13-142711324.png?sz=1200"}
More Quizzes
Weird awesome spirit animal quiz for my fellow penguins
840
CONTEMPORARY WORLD PRELIM FINALE
105244
How Well Do You Know Me? King Fugly edition.
19100
Do you have any recommendations in new papers today?
100
Free Zakat Calculation
201022300
Sigma Alpha Epsilon Phoenix: Test Your SAE Knowledge
201086731
Reveal Your Soulmate with Our Free Name Generator
201023917
Discover Your House of the Night Character - Take the
201027135
Bond Energy Practice Problems: Test Your Skills
201029519
What Country Should I Live In? Take the Now!
201031674
Free Run On Sentence
201022807
Free Employee Team Trivia Practice Test
201023722