wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

2902032025 - JAVA-DSA-DBMS-OOP

Total questions: 40

Worksheet time: 45mins

Name
Class
Date
1.
In an ER diagram, what do entities represent?
a)
Relationships between tables
b)
Physical storage location
c)
Real-world objects or concepts
d)
Database queries
2.
Which of the following best describes an attribute in an ER model?
a)
A link between entities
b)
A primary key
c)
A characterstic or property of an entity
d)
A type of relationship
3.
A relationship in an ER model that involves more than two entity types is known as:
a)
A binary relationship
b)
A ternary relationship
c)
A primary relationship
d)
An associative relationship
4.
To add a column named "Email" of type VARCHAR to an existing table named "Users", which SQL statement is correct?
a)
ALTER TABLE Users ADD COLUMN Email VARCHAR
b)
ALTER TABLE Users ADD Email VARCHAR
c)
UPDATE TABLE Users ADD Email VARCHAR
d)
INSERT INTO Users (Email) VALUES ('VARCHAR')
5.
What is the correct SQL statement to create a foreign key in the "Orders" table that references the "Customers" table's primary key?
a)
CREATE FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
b)
ALTER TABLE Orders ADD CONSTRAINT fk_customer FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
c)
ALTER TABLE Orders ADD FOREIGN KEY (CustomerID) REFERENCES Customers
d)
CREATE TABLE Orders ADD FOREIGN KEY CustomerID REFERENCES Customers
6.
In a graph of n nodes and n edges, how many cycles will be present?
a)
Exactly 1
b)
At most 1
c)
At most 2
d)
Depends on the graph
7.
Which of the following algorithms are used to find the shortest path from a source node to all other nodes in a weighted graph?
a)
BFS
b)
Dijkstra's Algorithm
c)
Prims Algorith
d)
Kruskal's Algorithm
8.
Which data structure is mainly used for implementing the recursive algorithm?
a)
Queue
b)
Stack
c)
Array
d)
List
9.
The time factor when determining the efficiency of algorithm is measured by
a)
Counting microseconds
b)
Counting the number of key operations
c)
Counting the number of statements
d)
Counting the kilobytes of algorithm
10.
The Average case occur in linear search algorithm
a)
When Item is somewhere in the middle of the array
b)
When Item is not in the array at all
c)
When Item is the last element in the array
d)
When Item is the last element in the array or is not there at all
11.
An algorithm that calls itself directly or indirectly is known as
a)
Sub algorithm
b)
Recursion
c)
Polish notation
d)
Traversal algorithm
12.
What happens when an object is passed by reference?
a)
Destructor is called at end of function
b)
Destructor is called when called explicitly
c)
Destructor is not called
d)
Destructor is called when function is out of scope
13.
Which feature of OOP reduces the use of nested classes?
a)
Inheritance
b)
Binding
c)
Abstraction
d)
Encapsulation
14.
Single level inheritance supports _____________ inheritance.
a)
Language independency
b)
Multiple inheritance
c)
Compile time
d)
Runtime
15.
How to overcome diamond problem?
a)
Using seperate derived class
b)
Using virtual keyword with same name function
c)
Can’t be done
d)
Using alias name
16.
What happens if non static members are used in static member function?
a)
Exxecutes fine
b)
Compile time error
c)
Executes if that member function is not used
d)
Runtime error
17.
Which of the following best describes member function overriding?
a)
Member functions having the same name in derived class only
b)
Member functions having the same name and different signature inside main function
c)
Member functions having the same name in base and derived classes
d)
Member functions having the same name in base class only
18.
Which among the following is not a necessary condition for constructors?
a)
Its name must be same as that of class
b)
It must not have any return type
c)
It must contain a definition body
d)
It can contains arguments
19.
If in multiple inheritance, class C inherits class B, and Class B inherits class A. In which sequence are their destructors called if an object of class C was declared?
a)
~A() then ~B() then ~C()
b)
~C() then ~A() then ~B()
c)
~C() then ~B() then ~A()
d)
~B() then ~C() then ~A()
20.

The maximum, minimum child for internal node in B-tree

a)

m/2,m

b)

m,m/2

c)

m,m/2-1

d)

m/2-1,m

21.

Circular Queue is also known as ________

a)

a) Ring Buffer

b)

b) Square Buffer

c)

c) Rectangle Buffer

d)

d) Curve Buffer

22.

To measure Time complexity of an algorithm Big O notation is used which:

a)

A. describes limiting behaviour of the function

b)

B. characterises a function based on growth of function

c)

C. upper bound on growth rate of the function

d)

D. all of the mentioned

23.

If for an algorithm time complexity is given by O(1) then complexityof it is:

a)

A. constant

b)

B. polynomial

c)

C. exponential

d)

D. none of the mentioned

24.

In the __________traversal we process all of a vertex’s descendents before we move to an adjacent vertex.

a)

Depth First

b)

Breadth First

c)

With First

d)

Depth Limited

25.

_____________is the method used by card sorter?

a)

Radix sort

b)

Insertion

c)

Heap

d)

Quick

26.

Other name for directed graph is _________

a)

Direct graph

b)

Digraph

c)

Dir-graph

d)

Dgraph

27.
If every non-key attribute is functionally dependent on the primary key, the relation will be in
a)
fourth formal form
b)
third normal form
c)
first normal form
d)
second normal form
28.
The attribute that can be divided into other attributes is called
a)
composite attribute
b)
derived attribute
c)
simple attribute
d)
multi-valued attribute
29.
Database locking concept is used to solve the problem of
a)
inconsistent data
b)
lost update
c)
uncommitted dependency
d)
all of the options
30.

predict output

a)

10

b)

5

c)

error

31.

At the end of this fragment of code what is r1.count value?

a)

10

b)

-5

c)

6

d)

7

e)

8

32.

With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?

a)

1, 2 & 3

b)

1 & 4

c)

1, 2, 3 & 4

d)

3 & 2

33.

String s = "Java String Quiz";

System.out.println(s.charAt(s.toUpperCase().length()));

a)

Convert “Z” to int 90 and prints “90”

b)

Runtime Exception

c)

Prints “z”

d)

Prints “Z”

34.

Output of following Java Program?

a)

Derived::show() called

b)

Base::show() called

c)

Run time Error

d)

Compilation Error

35.

What will be the output of the following program?

a)

n = 5

n = 4

n = 3

n = 2

n = 1

b)

n = 4

n = 3

n = 2

n = 1

c)

Compilation Error

d)

n = 5

n = 4

n = 3

n = 2

n = 1

n = 0

36.

class Main {

public static void main(String args[]) {

try {

throw 10;

}

catch(int e) {

System.out.println("Got the Exception " + e);

}

}

}

a)

Got the Exception 10

b)

Got the Exception 0

c)

Compiler Error

d)

none

37.

Does below program print “SUCCESS” on the console when you run it?

a)

YES

b)

NO

38.

Which algorithm does this image represent?

a)

Bubble sort

b)

Merge sort

c)

Linear search

d)

Binary Search

39.

What will be the output of the following Java program?

a)

0

b)

05

c)

Compilation Error

d)

Runtime Error

40.

What will be the output of this program?

a)

25,35

b)

25.34

c)

26.34

d)

26,36