wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Milking Minds 17-01-24

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

In queue, Insertion is happens at the __________ end.

a)

Rear

b)

front

c)

Top

d)

Bottom

e)

Both rear or front

2.

Which programming language is called the mother of programming languages?

a)

C++

b)

C

c)

Java

d)

COBOL

3.

What is the time complexity of binary search on a sorted array?

a)

O(n)

b)

O(log n)

c)

O(n log n)

d)

O(1)

4.

What is the difference between '== 'and '===' in JavaScript?

a)

They are the same

b)

'===' checks both value and type, while '==' checks only value

c)

'==' checks both value and type, while '===' checks only value

d)

'===' is not a valid operator in JavaScript

5.

What is the purpose of %2d in a printf statement?

a)

Prints the integer in hexadecimal format

b)

Prints the integer with at least 2 digits

c)

Prints the integer as a floating-point number with 2 decimal places

d)

None of the above

6.

What is output of below program?

int main()

{  int i,j,count;

count=0;

for(i=0; i<5; i++);

{

            for(j=0;j<5;j++);

            {

                count++;

            }

}

printf("%d",count);

return 0;

}

a)

55

b)

54

c)

1

d)

0

7.

Which of the following is used to declare a variable in Python?

a)

var

b)

let

c)

dim

d)

None of the above

8.

What is the time complexity of linear search in an unsorted array?

a)

O(log n)

b)

O(n)

c)

O(n^2)

d)

O(1)

9.

What is the purpose of the 'return' statement in a function?

a)

Terminates the function execution

b)

Sends a value back to the calling code

c)

Declares a variable

d)

Represents an error

10.

What is the difference between a list and a tuple in Python?

a)

Lists are immutable, and tuples are mutable

b)

Lists are ordered, and tuples are unordered

c)

Lists are resizable, and tuples are fixed-size

d)

Lists can contain heterogeneous elements, and tuples cannot

11.

Which algorithm is commonly used for finding the shortest path in a weighted graph?

a)

Breadth-First Search (BFS)

b)

Depth-First Search (DFS)

c)

Dijkstra's Algorithm

d)

Binary Search

12.

What will be the output of the following code snippet?

a)

1 2 3 4 5

b)

5 4 3 2 1

c)

1 3 5 2 4

d)

5 3 1 2 4

13.

What is output of below program?

int main()

{

 for(; ;);

 for(; ;);

    printf("Hello");

return 0;

}

a)

Compilation Error

b)

Runtime Error

c)

Nothing is printed

d)

Hello is printed infinite times

14.

Which of the following sorting algorithms provide the best time complexity in the worst-case scenario?

a)

Merge Sort

b)

Quick Sort

c)

Bubble Sort

d)

Selection Sort

15.

What is the use of 'javac' command?

a)

Execute a java program

b)

Debug a java program

c)

Interpret a java program

d)

Compile a java program

16.

What is output of below program?

a)

138

b)

264

c)

41

d)

25

17.

What is output of below program?

a)

a

b)

b

c)

c

d)

d

18.

What is output of below program?

a)

4.3

b)

4.0

c)

4

d)

Compilation Error

19.

Which of the following operators is used to get accurate result (i.e fraction part also) in case of division ?

a)

//

b)

%

c)

/

d)

None of the above

20.

What will be the output of the following Java code?

public class Main

{

public static void main(String[] args)

{

int x = 5;

int y = 3;

System.out.println(x / y);

}

}

a)

1

b)

2

c)

0

d)

3

21.

What is the purpose of the 'break' statement in a loop?

a)

Exits the loop and transfers control to the next statement

b)

Skips the current iteration and moves to the next iteration

c)

Terminates the program

d)

None of the above

22.

What is the difference between a stack and a queue in data structures?

a)

Stack follows LIFO (Last In First Out) order, while queue follows FIFO (First In First Out) order

b)

Stack follows FIFO (First In First Out) order, while queue follows LIFO (Last In First Out) order

c)

Stack is a linear data structure, while queue is a non-linear data structure

d)

Queue is a linear data structure, while stack is a non-linear data structure

23.

What will be the output of the following Python code?

numbers = [1, 2, 3, 4, 5]

print(numbers[2:4])

a)

[3, 4]

b)

[2, 3]

c)

[4, 5]

d)

[3, 4, 5]

24.

What is the purpose of the 'continue' statement in a loop?

a)

Exits the loop and transfers control to the next statement

b)

Skips the current iteration and moves to the next iteration

c)

Terminates the program

d)

None of the above

25.

What is the purpose of 'elif' in Python?

a)

To check for multiple conditions after an 'if' statement

b)

To define a new function

c)

To end a loop

d)

None of the above