NEW
Font size
WorksheetsQuiz
Total questions: 50
Worksheet time: 28mins
Worst- case time complexity of Linear search is
O(1)
O(n)
O(n log n)
O(log n)
What does the sizeof operator in C return?
Size of a variable in bytes
Size of a variable in bits
Number of elements in an array
Length of a string
Which sorting algorithm has the worst-case time complexity of O(n^2)?
All of them
Quick Sort
Bubble Sort
Insertion Sort
What will be the output of the following C code?
1020
2010
2020
Compiler Error
Which traversal method visits the root node, then the left subtree, and finally the right subtree?
Preorder traversal
Inorder traversal
Postorder traversal
Level order traversal
Which year was the C programming language invented?
1968
1971
1972
1973
In a binary tree, what is the maximum number of nodes at level 'k'?
2^(k+1) - 1
k + 1
k
2^k
What is the correct way to allocate memory for an array of 5 integers dynamically in C?
int arr = malloc(5 * sizeof(int));
int arr = malloc(5 * sizeof(int));
int arr[5];
int *arr = malloc(sizeof(int));
How are String represented in memory in C?
An array of characters.
The object of some class.
Same as other primitive data types.
LinkedList of characters.
What will be the output of following C code snippet?
6
8
9
15
Which of the following is the disadvantage of the array?
Stack and Queue data structures can be implemented through an array.
Index of the first element in an array can be negative
Wastage of memory if the elements inserted in an array are lesser than the allocated size
Elements can be accessed sequentially
Difference between break and continue.
break is used to end the program and continue is used for ending the loop
break is used to end a loop and continue skips to the next iteration
break is a keyword and continue is an identifier
None of the above
What is the output of the below code?
10
50
Garbage value
None of the above
Which of the following is true for variable names in C?
They can contain alphanumeric characters as well as special characters
It is not an error to declare a variable to be one of the keywords(like goto, static)
Variable names cannot start with a digit
Variable can be of any length
If the elements '1', '2', '3' and '4' are inserted in a queue, what would be order for the removal?
1234
4321
3241
None of the above
scanf() is a predefined function in____header file.
stdarg. h
stdlib. h
ctype. h
stdio. h
Which data structure is used for implementing recursion?
Stack
Queue
List
Array
Which of the following declaration is not supported by C language?
String str;
char *str;
float str = 3e2;
Both “String str;” and “float str = 3e2;”
Which data structure is needed to convert infix notation to postfix notation?
Tree
Branch
Stack
Queue
Which of the following typecasting is accepted by C language?
Widening conversions
Narrowing conversions
Widening & Narrowing conversions
None of the mentioned
The data structure required for Breadth First Traversal on a graph is?
Array
Stack
Queue
Tree
What is #include <stdio.h>?
Preprocessor directive
Inclusion directive
File inclusion directive
None of the mentioned
The prefix form of A-B/ (C * D ^ E) is?
-A/BC^DE
-A/BC*^DE
-ABCD*^DE
-/*^ACBDE
Which keyword is used to prevent any changes in the variable within a C program?
immutable
mutable
const
volatile
The data structure required to check whether an expression contains a balanced parenthesis is?
Queue
Stack
Tree
Array
What will happen if the following C code is executed?
It will cause a compile-time error
It will cause a run-time error
It will run without any error and prints 3
It will experience infinite looping
What is the advantage of a hash table as a data structure?
easy to implement
faster access of data
exhibit good locality of reference
very efficient for less number of entries
What is the result of logical or relational expression in C?
True or False
0 or 1
0 if an expression is false and any positive number if an expression is true
None of the mentioned
Which type of data structure is a ternary heap?
Priority Queue
Hash
Array
Priority Stack
Which of the following data structures is NOT a linear data structure?
Stack
Queue
Tree
Heap
What will be the output of the code?
0
10
20
30
What is the time complexity of searching an element in a sorted array of size 𝑛 using binary search?
O(log n)
O(n)
O(n log n)
O(n^2)
What's recursion in programming?
Loop type
Declares variables together
Sorts arrays
Function calls itself
Which of the following operations is typically NOT supported by a Queue data structure?
Enqueue
Dequeue
Pop
Peek
What will be the output of the code?
1
2
3
4
Which sorting algorithm has the best average-case time complexity?
Insertion Sort
Bubble Sort
Quick Sort
Selection Sort
What will be the output of following C code snippet.
6
7
8
Compile Error
Which searching algorithm requires the data to be sorted beforehand?
Linear Search
Binary Search
Depth-First Search
Breadth-First Search
What will be the output of following C code snippet.
Hello
World
Hello World
Compile Error
Which of the following sorting algorithms is stable?
Quick Sort
Heap Sort
Shell Sort
Merge Sort
What will be the output of following C code snippet.
H
e
o
Segmentation Fault
What is the space complexity of Quick Sort in the worst-case scenario?
O(n)
O(log n)
O(n^2)
O(n log n)
What will be the output of following C code snippet.
10 11 12
10 11 11
10 12 12
Undefined behavior
What is the time complexity of inserting an element at the end of an array with n elements, assuming no resizing is required?
O(1)
O(log n)
O(n)
O(n^2)
What will be the output of following C code snippet.
0 1 2 3 4
0 2 4
0 1 2 3
0 1 2 3 4 5
The data structure is required for Depth First Traversal on a graph is?
Array
Stack
Queue
Tree
What is an example of iteration in C?
while
do-while
for
all of the mentioned
Which data structure is based on the Last In First Out (LIFO) principle?
Stack
Queue
Linked List
Tree
The C-preprocessors are specified with ___ symbol.
#
$
” ”
&
Which of the following is not the type of queue?
Priority queue
Circular queue
Single ended queue
Ordinary queue
