NEW
Font size
WorksheetsTechsaavy Codeathon 2k25 Round 1
Total questions: 25
Worksheet time: 10mins
Predict the output
x = 10
x //= 3
print(x)
3
3.33
4
0
Which of the following is NOT a valid C++ identifier?
_var
var_123
123var
init
Which data structure uses FIFO principle?
Stack
Queue
Tree
Graph
Predict the output
a = [1, 2, 3]
b = a
b.append(4)
print(a)
[1,2,3]
[1,2,3,4]
[4,1,2,3]
[4]
Predict the output
int a = 5, b = 2;
cout << a / b * b;
2
4
5
6
Predict the output
int x = 5;
cout << x++ + ++x;
11
12
Undefined behavior
13
Predict the output
int arr[] = {1,2,3,4};
cout << sizeof(arr)/sizeof(arr[0]);
16
4
8
2
Predict the output
print(2**3**2)
512
64
256
Error
Predict the ouput
System.out.println(10 + 20 + "30" + 40);
303040
7030
10203040
3070
Predict the output
String str1 = "Hello";
String str2 = "Hello";
System.out.println(str1 == str2);
true
false
Error
JVM dependent
Predict the output
int arr[] = {1,2,3,4};
int *p = arr;
cout << *(p+3);
2
3
4
Undefined
Predict the output
print(bool("False"))
False
True
0
1
Which of the following problems can be solved using Dynamic Programming?
Fibonacci Sequence
Longest Common Sequence
Knapsack problem
All of the above
Which of the following is a valid way to declare a constant in C++?
Both B and C
const int x=10;
int const x = 10;
None of the above
Predict the output
cout << (10 & 7);
7
2
3
10
Which sorting algorithm has best average-case time complexity?
Bubble sort
Quick sort
Selection sort
Insertion sort
Predict the output
String s = "abc";
s.concat("def");
System.out.println(s);
abc
abcdef
defabc
Compilation error
What is C++ vector insertion amortized time complexity?
O(1)
O(n)
O(log n)
O(n log n)
Which is NOT true about C++ unordered_map?
Keys stored in sorted order
Average search is O(1)
Uses hashing internally
Unique keys only
Which sorting algorithm is NOT stable?
Merge sort
Insertion sort
Quick sort
Bubble sort
Guess the output:
def func(x, l=[]):
l.append(x)
return l
print(func(1))
print(func(2))
[1]
[2]
[1]
[1,2]
[1]
[2,1]
(1)
(1,2)
Which algorithm gives the shortest path with negative edges?
Dijkstra
Bellman-Ford
Floyd-Warshall
BFS
What is the auxiliary space of merge sort?
O(1)
O(n)
O(n log n)
O(log n)
For a graph with V vertices and E edges, the time complexity of Dijkstra’s algorithm using a min-heap is?
O(V²)
O(E log V)
O(E + V log V)
O(V log E)
Which traversal method of a binary tree can be used to obtain nodes in
NON-DECREASING ORDER if the tree is a BST?
Preorder
Postorder
Inorder
Level-order
