NEW
Font size
WorksheetsRevision SWC Part 1
Total questions: 35
Worksheet time: 18mins
Which of the following best defines an algorithm?
A computer program written in Java
A sequence of precise steps to solve a problem
A flowchart for data storage
A syntax rule in programming
Which property ensures an algorithm eventually stops?
Correctness
Definiteness
Finiteness
Effectiveness
The efficiency of an algorithm is mainly measured in terms of:
Speed and accuracy
Time and space
Input and output
Memory type
Pseudocode is used to:
Execute programs
Plan the algorithm in human-readable form
Test syntax errors
Debug runtime errors
Flowchart symbols are mainly used to:
Represent program output only
Show data types
Represent program logic graphically
Show code indentation
Which of the following is not a control structure?
Sequence
Selection
Repetition
Definition
A runtime error occurs when:
The syntax is wrong
The logic is incorrect
The program executes but produces an unexpected issue
The compiler stops due to missing semicolon
Which of the following is not a principle of OOP?
Polymorphism
Modularity
Compilation
Inheritance
Which concept in OOP is about hiding internal details and exposing only necessary information?
Encapsulation
Abstraction
Modularity
Polymorphism
In Java, an object is created using:
create new Object()
Object obj = Object();
Object obj = new Object();
Object = new()
The keyword void in Java means:
Function returns a string
Function does not return any value
Function ends immediately
Function is private
Which of the following is a reference data type?
int
double
Array
char
Wrapper classes are used to:
Convert primitive types into objects
Store multiple values in a single variable
Run methods faster
Debug logic errors
Example of wrapper class for int:
Number
IntClass
Integer
WrapperInt
The if-else and switch statements are examples of:
Repetition control
Sequence control
Selection control
Conditional loops
Which loop repeats until a condition is no longer true?
while loop
if-else statement
switch statement
case control
Recursion refers to:
Repeating instructions using loops
A function calling itself to solve a smaller problem
Data stored in arrays
A function with no parameters
In recursion, the base case means:
The point where recursion starts
The stopping condition of recursion
The function’s first line
The loop condition
What will happen if there is no base case in a recursive function?
Compilation error
Infinite recursion → stack overflow
The function will stop automatically
It becomes iterative
Which OOP concept allows objects to take multiple forms?
Inheritance
Encapsulation
Polymorphism
Abstraction
Which interface forms the root of the Java Collections Framework hierarchy?
Set
List
Map
Collection
Which keyword is used to inherit a class in Java?
inherit
super
extends
implements
Which Java class provides dynamic array functionality?
Vector
Array
ArrayList
LinkedList
A list refers to:
A non-linear collection of data
A linear collection of data that allows duplicates
A fixed collection with no duplicate elements
A random access structure only for unique values
The major drawback of using arrays in Java is:
Arrays can only hold integers
Array size is fixed at compile time
Arrays cannot hold duplicate elements
Arrays are slower than lists
When you remove an element from an Array, what happens?
The size decreases automatically
The removed slot becomes empty or null
The array shifts elements automatically
The array deletes itself
When you remove an element from a List (like ArrayList):
The slot remains empty
The following elements shift left automatically
The list size stays the same
The program must be restarted
The head of a list refers to:
The last element
The middle element
The first element
The element with the largest value
In Java, List is:
A class
A package
An interface
A primitive data type
What happens when the capacity of an ArrayList is exceeded?
It throws an error
It automatically enlarges
It deletes the oldest data
It becomes read-only
Which is faster for frequent insertions and deletions?
ArrayList
LinkedList
Vector
Stack
What is an iterator in a linked list?
A node storing data
A pointer marking current position
The first node
A data container
In a doubly linked list, each node contains:
Only next link
Next and previous links
Two data values only
Head and tail markers
What is the main advantage of a doubly linked list?
Simpler structure
Less memory usage
Easy traversal in both directions
Faster random access
In a circular linked list, the last node’s next pointer points to:
The tail
The head node
null
A random node
