wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming and Database Quiz

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

Which of the following statements about tokens is TRUE?

a)

Keywords can be redefined using macros

b)

Identifiers can start with digits

c)

Constants are not considered tokens

d)

Operators and separators are tokens

2.

Which flow control statement can cause unreachable code even without a loop?

a)

break

b)

continue

c)

return

d)

goto

3.

Which OOP principle is violated if a subclass accesses private data members using pointers?

a)

Inheritance

b)

Polymorphism

c)

Encapsulation

d)

Abstraction

4.

Which scenario BEST represents abstraction?

a)

Hiding data using private access

b)

Multiple inheritance

c)

Exposing only essential features

d)

Overloading constructors

5.

Which of the following cannot be overridden in Java?

a)

static methods

b)

protected methods

c)

public methods

d)

abstract methods

6.

Constructor chaining is achieved using:

a)

super() and this()

b)

virtual constructors

c)

friend functions

d)

dynamic binding

7.

Which relationship is represented by composition?

a)

IS-A

b)

HAS-A (strong ownership)

c)

HAS-A (weak ownership)

d)

USES-A

8.

Which feature resolves method call at runtime?

a)

Method overloading

b)

Templates

c)

Dynamic binding

d)

Inline functions

9.

Which exception is checked at compile time?

a)

ArithmeticException

b)

NullPointerException

c)

IOException

d)

ArrayIndexOutOfBoundsException

10.

Which pseudocode construct guarantees execution at least once?

a)

while

b)

for

c)

do–while

d)

if–else

11.

Which normal form removes partial dependency?

a)

1NF

b)

2NF

c)

3NF

d)

BCNF

12.

Which key uniquely identifies tuples and may contain NULL values?

a)

Primary key

b)

Candidate key

c)

Foreign key

d)

Super key

13.

Which SQL command is DDL?

a)

INSERT

b)

UPDATE

c)

ALTER

d)

SELECT

14.

Which isolation level prevents dirty reads but allows non-repeatable reads?

a)

Read Uncommitted

b)

Read Committed

c)

Repeatable Read

d)

Serializable

15.

Lost update problem occurs due to:

a)

Lack of atomicity

b)

Lack of isolation

c)

Lack of durability

d)

Lack of consistency

16.

Which join returns matching rows and unmatched rows from both tables?

a)

Inner join

b)

Left outer join

c)

Right outer join

d)

Full outer join

17.

Which index structure supports range queries efficiently?

a)

Hash index

b)

B+ Tree

c)

Bitmap index

d)

Heap file

18.

Which command permanently saves a transaction?

a)

ROLLBACK

b)

SAVEPOINT

c)

COMMIT

d)

CHECKPOINT

19.

Authorization in DBMS mainly ensures:

a)

Data consistency

b)

Data integrity

c)

Data availability

d)

Controlled access

20.

Which anomaly is eliminated by normalization?

a)

Retrieval anomaly

b)

Insertion anomaly

c)

Search anomaly

d)

Memory anomaly

21.

Which SDLC model is BEST for unclear requirements?

a)

Waterfall

b)

V-Model

c)

Spiral

d)

Big Bang

22.

Which Agile artifact represents work to be done?

a)

Product Backlog

b)

Sprint Review

c)

Daily Scrum

d)

Burnup chart

23.

In Scrum, who prioritizes backlog items?

a)

Scrum Master

b)

Product Owner

c)

Development Team

d)

Stakeholders

24.

Which UML diagram shows object interactions over time?

a)

Class diagram

b)

Use case diagram

c)

Sequence diagram

d)

Activity diagram

25.

Which principle states “high cohesion and low coupling”?

a)

KISS

b)

SOLID

c)

Separation of Concerns

d)

DRY

26.

White-box testing focuses on:

a)

Functional behavior

b)

Internal logic

c)

User experience

d)

Requirements

27.

Cyclomatic complexity measures:

a)

Code size

b)

Code readability

c)

Independent paths

d)

Execution time

28.

Which metric measures project progress over time?

a)

LOC

b)

Burn-down chart

c)

Defect density

d)

Cohesion

29.

XP emphasizes:

a)

Documentation

b)

Customer involvement

c)

Formal reviews

d)

Big design upfront

30.

Software maintenance consuming highest cost is:

a)

Corrective

b)

Adaptive

c)

Perfective

d)

Preventive

31.

Time complexity of binary search in worst case:

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n log n)

32.

Which data structure is best for implementing recursion?

a)

Queue

b)

Stack

c)

Tree

d)

Graph

33.

In a singly linked list, deletion of a node requires access to:

a)

Next node

b)

Previous node

c)

Head node

d)

Tail node

34.

Which traversal of BST gives sorted order?

a)

Preorder

b)

Postorder

c)

Level order

d)

Inorder

35.

Which heap property is used in priority queue?

a)

Complete binary tree

b)

Binary search tree

c)

Heap order property

d)

Graph property

36.

Hashing gives best performance when:

a)

Load factor is high

b)

Collision rate is high

c)

Load factor is low

d)

Table is full

37.

Dijkstra’s algorithm fails when graph has:

a)

Cycles

b)

Directed edges

c)

Negative weights

d)

Self loops

38.

Which sorting algorithm is stable?

a)

Quick sort

b)

Heap sort

c)

Merge sort

d)

Selection sort

39.

Greedy algorithm may fail for:

a)

MST

b)

Huffman coding

c)

0/1 Knapsack

d)

Job sequencing

40.

Optimal substructure is a property of:

a)

Greedy algorithms

b)

Dynamic Programming

c)

Backtracking

d)

Divide and Conquer