wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

202508500002

Total questions: 40

Worksheet time: 40mins

Name
Class
Date
1.

What is a Schema in a Relational Database?

a)

A graphical representation of data relationships

b)

A collection of related tables

c)

A blueprint that defines the structure of the database

d)

A database query language

e)

A type of database key

2.

Which of the following statements about indexing is/are true?

a)

Indexes speed up data retrieval operations

b)

Indexes increase the size of the database

c)

Indexes are automatically created on all columns

d)

Indexes can be created only on primary key columns

e)

Indexes can replace the need for primary keys

3.

Which SQL query returns employees who earn more than the average salary?

a)

SELECT * FROM employees WHERE salary > AVG(salary);

b)

SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM employees);

c)

SELECT * FROM employees HAVING salary > AVG(salary);

d)

SELECT * FROM employees GROUP BY salary > AVG(salary);

e)

SELECT * FROM employees WHERE salary = MAX(salary);

4.

Which SQL statement(s) can be used to rename a column?

a)

ALTER TABLE table_name RENAME COLUMN old_name TO new_name;

b)

MODIFY TABLE table_name CHANGE old_name new_name datatype;

c)

UPDATE COLUMN table_name SET new_name;

d)

ALTER COLUMN table_name RENAME old_name new_name;

e)

ALTER TABLE table_name ALTER COLUMN old_name RENAME TO new_name;

5.

Which statements about the IN and EXISTS operators are true?

a)

IN is generally faster than EXISTS

b)

EXISTS returns TRUE if the subquery returns at least one row

c)

IN cannot be used with subqueries

d)

EXISTS is more efficient in correlated subqueries

e)

Both IN and EXISTS can return NULL

6.

Which query returns the count of employees per job title sorted in descending order of count?

a)

SELECT job_title, COUNT(*) FROM employees GROUP BY job_title ORDER BY job_title DESC;

b)

SELECT job_title, COUNT(*) FROM employees GROUP BY job_title ORDER BY COUNT(*) DESC;

c)

SELECT COUNT(job_title) FROM employees ORDER BY COUNT(*) DESC;

d)

SELECT job_title, COUNT(*) FROM employees ORDER BY job_title;

e)

SELECT COUNT(*) FROM employees GROUP BY job_title DESC;

7.

Which query finds the total salary per department for departments with more than 2 employees?

a)

SELECT department_id, SUM(salary) FROM employees GROUP BY department_id HAVING COUNT(*) > 2;

b)

SELECT department_id, salary FROM employees HAVING COUNT(*) > 2;

c)

SELECT department_id, SUM(salary) FROM employees WHERE COUNT(*) > 2;

d)

SELECT SUM(salary) FROM employees GROUP BY salary;

e)

SELECT department_id, salary FROM employees WHERE salary > 50000;

8.

What is the purpose of the CASE statement in SQL?

a)

Perform conditional logic in queries

b)

Check table constraints

c)

Create temporary tables

d)

Define views

e)

Execute subqueries

9.

You're using 3NF, but find that data anomalies still occur due to transitive dependencies. What should you normalize to?

a)

2NF

b)

BCNF

c)

4NF

d)

3NF

10.

A transaction must ensure other transactions cannot view its intermediate states. Which ACID property is this?

a)

Atomicity

b)

Consistency

c)

Isolation

d)

Durability

e)

Idempotency

11.

Which concept allows an object to behave differently in different contexts?

a)

Encapsulation

b)

Inheritance

c)

Polymorphism

d)

Composition

e)

Static binding

12.

What is the outcome of calling a method that’s been overloaded, not overridden?

a)

Runtime resolution

b)

Static (compile-time) resolution

c)

Causes ambiguity

d)

Calls base method

e)

Depends on inheritance

13.

Which relationship is shown by ‘has-a’?

a)

Inheritance

b)

Composition

c)

Abstraction

d)

Polymorphism

e)

Overloading

14.

Which scenario would best use method overloading?

a)

Multiple classes with same method

b)

One class needing same method with different params

c)

Runtime polymorphism

d)

Changing behavior at runtime

e)

Inheriting class functionality

15.

A class User has fields name, email, password that should not be accessible from outside. You use private access modifier. This is:

a)

Polymorphism

b)

Abstraction

c)

Inheritance

d)

Encapsulation

e)

Delegation

16.

A subclass redefines a method from its superclass. What is this called?

a)

Overloading

b)

Overriding

c)

Overruling

d)

None of the mentioned

e)

Masking

17.

Given an array of n integers, how many distinct pairs (i, j) exist such that arr[i] + arr[j] = target in O(n) time?

a)

Use two loops

b)

Use a hash set

c)

Use sorting

d)

Use sliding window

e)

Use merge sort

18.

What is the best time complexity to search for an element in a sorted and rotated array?

a)

O(n)

b)

O(log n)

c)

O(1)

d)

O(n log n)

e)

O(n²)

19.

What is the minimum number of swaps required to sort an array of size n using cycle detection?

a)

O(n²)

b)

O(log n)

c)

O(n log n)

d)

O(n)

e)

O(1)

20.

Which of the following is used to implement two stacks in an array without wastage of space?

a)

Push one after another

b)

Use two arrays

c)

Divide array equally

d)

One from start and one from end

e)

Use doubly linked list

21.

Which data structure is most efficient for implementing an LRU Cache?

a)

Queue only

b)

Stack and array

c)

Hash Map + Doubly Linked List

d)

BST

e)

Graph

22.

Which problem can be optimally solved using a monotonic stack?

a)

Binary Tree traversal

b)

Longest Common Subsequence

c)

Next Greater Element

d)

Kruskal’s algorithm

e)

Sliding window maximum

23.

What’s the maximum number of edges in a directed graph with n nodes and no self-loops?

a)

n(n+1)

b)

c)

n(n–1)

d)

2n

e)

n(n–1)/2

24.

Which sorting algorithm is stable and not in-place?

a)

Heap Sort

b)

Quick Sort

c)

Merge Sort

d)

Selection Sort

e)

Shell Sort

25.

Which of these sorting algorithms has O(n²) time in both best and worst case?

a)

Bubble Sort

b)

Merge Sort

c)

Insertion Sort

d)

Quick Sort

e)

Counting Sort

26.

Which sorting algorithm is not comparison-based?

a)

Merge Sort

b)

Counting Sort

c)

Quick Sort

d)

Bubble Sort

e)

Heap Sort

27.

Which sorting algorithm is least efficient on large data?

a)

Quick Sort

b)

Merge Sort

c)

Bubble Sort

d)

Heap Sort

e)

Counting Sort

28.

Which of the following problems is best solved using Dynamic Programming?

a)

Binary Search

b)

Tower of Hanoi

c)

Longest Increasing Subsequence

d)

Tree Traversal

e)

Depth First Search

29.

Which technique helps to reduce space complexity in bottom-up DP?

a)

Tree traversal

b)

Memoization

c)

Tabulation

d)

State compression

e)

Randomization

30.

Which of the following problems is not typically solved using dynamic programming?

a)

Longest Common Subsequence

b)

Matrix Chain Multiplication

c)

Dijkstra's Algorithm

d)

Longest Increasing Subsequence

e)

Coin Change

31.

What is the main idea of overlapping subproblems in DP?

a)

Problems depend on previous state

b)

Same subproblems solved multiple times

c)

Problems cannot be divided

d)

Problems are unrelated

e)

Subproblems do not require storage

32.

Which method is used in solving Longest Palindromic Subsequence using DP?

a)

Sliding window

b)

Hashing

c)

Two-pointer

d)

Reverse string and find LCS

e)

Stack-based

33.

Round Robin scheduling is most suitable for:

a)

Long batch jobs

b)

Real-time systems

c)

Interactive systems

d)

High throughput

e)

Low latency tasks

34.

The working set model is used for:

a)

Deadlock prevention

b)

Cache replacement

c)

Memory management

d)

Disk scheduling

e)

Multithreading

35.

Which statement about threads is false?

a)

Threads share memory

b)

Threads are faster to create

c)

Threads can’t run on separate cores

d)

Threads have their own stack

e)

Threads allow better parallelism

36.

A system with 4 resources and processes with maximum need vectors: P1: (3), P2: (2), P3: (2) If all request 1 instance, will it be in a safe state?

a)

Yes

b)

No

c)

Depends on order

d)

Unsafe

e)

Can’t determine

37.

The Banker's Algorithm is used for:

a)

CPU scheduling

b)

Deadlock detection

c)

Memory allocation

d)

Deadlock avoidance

e)

File system protection

38.

What is the purpose of subnet mask?

a)

Encrypt traffic

b)

Find default gateway

c)

Determine network and host portion

d)

Assign DNS

e)

Set TTL

39.

What’s the advantage of IPv6 over IPv4?

a)

Less bandwidth

b)

Shorter addresses

c)

More address space

d)

Easier subnetting

e)

Lower latency

40.

Which protocol supports connectionless communication?

a)

TCP

b)

FTP

c)

UDP

d)

SSH

e)

Telnet