NEW
Font size
WorksheetsMilking Minds 17-01-24
Total questions: 25
Worksheet time: 13mins
In queue, Insertion is happens at the __________ end.
Rear
front
Top
Bottom
Both rear or front
Which programming language is called the mother of programming languages?
C++
C
Java
COBOL
What is the time complexity of binary search on a sorted array?
O(n)
O(log n)
O(n log n)
O(1)
What is the difference between '== 'and '===' in JavaScript?
They are the same
'===' checks both value and type, while '==' checks only value
'==' checks both value and type, while '===' checks only value
'===' is not a valid operator in JavaScript
What is the purpose of %2d in a printf statement?
Prints the integer in hexadecimal format
Prints the integer with at least 2 digits
Prints the integer as a floating-point number with 2 decimal places
None of the above
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;
}
55
54
1
0
Which of the following is used to declare a variable in Python?
var
let
dim
None of the above
What is the time complexity of linear search in an unsorted array?
O(log n)
O(n)
O(n^2)
O(1)
What is the purpose of the 'return' statement in a function?
Terminates the function execution
Sends a value back to the calling code
Declares a variable
Represents an error
What is the difference between a list and a tuple in Python?
Lists are immutable, and tuples are mutable
Lists are ordered, and tuples are unordered
Lists are resizable, and tuples are fixed-size
Lists can contain heterogeneous elements, and tuples cannot
Which algorithm is commonly used for finding the shortest path in a weighted graph?
Breadth-First Search (BFS)
Depth-First Search (DFS)
Dijkstra's Algorithm
Binary Search
What will be the output of the following code snippet?
1 2 3 4 5
5 4 3 2 1
1 3 5 2 4
5 3 1 2 4
What is output of below program?
int main()
{
for(; ;);
for(; ;);
printf("Hello");
return 0;
}
Compilation Error
Runtime Error
Nothing is printed
Hello is printed infinite times
Which of the following sorting algorithms provide the best time complexity in the worst-case scenario?
Merge Sort
Quick Sort
Bubble Sort
Selection Sort
What is the use of 'javac' command?
Execute a java program
Debug a java program
Interpret a java program
Compile a java program
What is output of below program?
138
264
41
25
What is output of below program?
a
b
c
d
What is output of below program?
4.3
4.0
4
Compilation Error
Which of the following operators is used to get accurate result (i.e fraction part also) in case of division ?
//
%
/
None of the above
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);
}
}
1
2
0
3
What is the purpose of the 'break' statement in a loop?
Exits the loop and transfers control to the next statement
Skips the current iteration and moves to the next iteration
Terminates the program
None of the above
What is the difference between a stack and a queue in data structures?
Stack follows LIFO (Last In First Out) order, while queue follows FIFO (First In First Out) order
Stack follows FIFO (First In First Out) order, while queue follows LIFO (Last In First Out) order
Stack is a linear data structure, while queue is a non-linear data structure
Queue is a linear data structure, while stack is a non-linear data structure
What will be the output of the following Python code?
numbers = [1, 2, 3, 4, 5]
print(numbers[2:4])
[3, 4]
[2, 3]
[4, 5]
[3, 4, 5]
What is the purpose of the 'continue' statement in a loop?
Exits the loop and transfers control to the next statement
Skips the current iteration and moves to the next iteration
Terminates the program
None of the above
What is the purpose of 'elif' in Python?
To check for multiple conditions after an 'if' statement
To define a new function
To end a loop
None of the above
