Primitive Types
What does 'encapsulation' refer to in object-oriented programming?
Reusing existing code for new purposes without modification.
Running multiple threads or processes simultaneously.
Hiding internal data while exposing methods to interact with it.
Breaking down problems into smaller, more manageable functions.
What is an advantage of dividing a large class into smaller helper classes?
It enhances readability by organizing related tasks together.
It allows all methods within a helper class to directly access private fields of other classes.
It merges multiple functionalities, increasing coupling between features.
It significantly reduces the amount of memory needed by the program.
How do classes contribute to software reusability?
They encapsulate behaviors that can be inherited by other classes.
They mandate that every class must implement interfaces for polymorphism.
They require all methods be static so they can be called without objects.
They force all data members to become public for universal access.
Which data structure is most appropriate for implementing a depth-first search (DFS) on a graph?
Stack
Queue
Priority queue
Set
In Java, what happens if an exception is thrown inside a method with no matching catch block or throws clause?
The Java Virtual Machine automatically handles all uncaught exceptions internally without any impact on methods calling it.
The method terminates and passes the exception up to its caller method.
Execution continues within that method after skipping over only code where an error occurred without handling it elsewhere.
An infinite loop begins as Java continually tries to execute code where an error occurred until successful completion is achieved without handling it elsewhere.
What results from the substitution of a recursive algorithm with an iterative one for computing Fibonacci numbers when considering memory usage?
Unchanged memory usage since both approaches are equivalent in space complexity.
Increased memory fragmentation as iteration causes non-contiguous allocation.
Increased memory usage as iteration requires more variables.
Decreased memory usage due to elimination of stack calls.
Which symbol represents logical AND in Java?
&&
||
==
!

How are we doing?
Give us your feedback and let us know how we can improve
Which of the following best describes a situation where a binary search is more efficient than a linear search?
When searching for an element in a sorted array.
When searching for an element in an unsorted linked list.
When inserting an element into an unsorted array.
When deleting all occurrences of an element in a doubly-linked list.
For quick searching of an unsorted list that will not be modified often, which data structure is most appropriate?
Binary search tree
Array list
Hash table
Linked list
In terms of algorithm analysis what does it mean when an algorithm's runtime complexity is described as O(n)?
Runtime doubles every time input volume increases by one unit.
Runtime decreases inversely proportionally to the input volume.
The runtime grows linearly with input size.
Runtime remains constant no matter input size.