Techno thirst 2k25 Debugging context.
Round 1 mcq (PHASE 1)
C language
1. Which of the following data types in C has the highest precedence in arithmetic operations?
A) int
B) float
C) double
D) long
✅ Answer: C) double
2. Which of the following statements about arrays in C is true?
A) The index of an array starts from 1
B) The array size can be changed after declaration
C) Arrays are stored in contiguous memory locations
D) Arrays can contain different data types
✅ Answer: C) Arrays are stored in contiguous memory locations
3. What is the main difference between struct and union in C?
A) struct uses less memory than union
B) union stores all members at the same memory location
C) struct stores all members in one variable
D) Both store data in the same way
✅ Answer: B) union stores all members at the same memory location
4. Which of the following statements about pointers is incorrect?
A) Pointer stores the address of another variable
B) * is used for dereferencing a pointer
C) & is used to get the address of a variable
D) Pointer arithmetic can be done with all data types
✅ Answer: D) Pointer arithmetic can be done with all data types
5. Which function is used to deallocate dynamically allocated memory in C?
A) remove()
B) free()
C) delete()
D) dispose()
✅ Answer: B) free()
6. Predict the output:
#include <stdio.h>
int main() {
int a = 5, b = 3;
printf("%d", a % b);
return 0;
}
A) 2
B) 1
C) 0
D) 3
✅ Answer: A) 2
7. Predict the output:
#include <stdio.h>
int main() {
int x = 10;
x += 5 * 2;
printf("%d", x);
}
A) 20
B) 15
C) 25
D) 30
✅ Answer: C) 20
8. Predict the output:
#include <stdio.h>
int main() {
int i;
for(i = 0; i < 5; i++);
printf("%d", i);
}
A) 0 1 2 3 4
B) 5
C) 0
D) Infinite loop
✅ Answer: B) 5
9. Predict the output:
#include <stdio.h>
int main() {
int a = 1;
switch(a) {
case 1: printf("One");
case 2: printf("Two");
default: printf("Default");
}
return 0;
}
A) One
B) OneTwo
C) OneTwoDefault
D) OneDefault
✅ Answer: D) OneDefault
10. Predict the output:
#include <stdio.h>
int main() {
char str[] = "Hello";
printf("%c", *(&str[2] + 1));
}
A) l
B) o
C) e
D) H
✅ Answer: B) o
11. Predict the output:
x = 5
y = 2
print(x ** y)
A) 10
B) 25
C) 2.5
D) 7
✅ Answer: B) 25
12. Predict the output:
a = "Python"
print(a[2:5])
A) Pyt
B) yth
C) tho
D) ytho
✅ Answer: B) yth
13. Predict the output:
list1 = [1, 2, 3]
list2 = list1
[Link](4)
print(list1)
A) [1, 2, 3]
B) [1, 2, 3, 4]
C) [4]
D) Error
✅ Answer: B) [1, 2, 3, 4]
14. Predict the output:
def func(x=[]):
[Link](1)
return x
print(func())
print(func())
A) [1], [1]
B) [1, 1], [1, 1]
C) [1], [1, 1]
D) Error
✅ Answer: C) [1], [1, 1]
15. Predict the output:
a, b = 5, 0
try:
print(a / b)
except ZeroDivisionError:
print("Cannot divide by zero")
finally:
print("Done")
A) Error
B) 0 Done
C) Cannot divide by zero Done
D) Done
✅ Answer: C) Cannot divide by zero Done
Round 1 mcq (PHASE 2)
1. What will be the result of the following code snippet?
#include <stdio.h>
void solve() {
char ch[10] = "abcdefghij";
int ans = 0;
for(int i = 0; i < 10; i++) {
ans += (ch[i] - 'a');
}
printf("%d", ans);
}
int main() {
solve();
return 0;
}
a. 45
b. 36
c. 20
d. 100
2. What will be the output of the following code snippet?
#include <stdio.h>
struct School {
int age, rollNo;
};
void solve() {
struct School sc;
[Link] = 19;
[Link] = 82;
printf("%d %d", [Link], [Link]);
}
int main() {
solve();
return 0;
}
a. 19 82
b. Compilation error
c. 8219
d. None of the above
3. What will be the output of the following code snippet?
#include <stdio.h>
void solve() {
int a[] = {1, 2, 3, 4, 5};
int sum = 0;
for(int i = 0; i < 5; i++) {
if(i % 2 == 0) {
sum += *(a + i);
}
else {
sum -= *(a + i);
}
}
printf("%d", sum);
}
int main() {
solve();
return 0;
}
a. 2
b. 15
c. Syntax error
d. 3
4. What will be the output of the following code snippet?
#include <stdio.h>
void solve() {
int x = 2;
printf("%d", (x << 1) + (x >> 1));
}
int main() {
solve();
return 0;
}
a. 5
b. 4
c. 2
d. 1
5. What will be the output of the following code snippet?
#include <stdio.h>
#define VAL 5
int getInput() {
return VAL;
}
void solve() {
const int x = getInput();
printf("%d", x);
}
int main() {
solve();
return 0;
}
a. 5
b. Garbage value
c. Compilation error
d. 0
6. Which data structure is used to handle recursion in C?
a. Stack
b. Queue
c. Deque
d. Trees
7. Which of the following are correct file opening modes in C?
a. r
b. rb
c. w
d. All of the above
8. Which of the following are not standard header files in C?
a. stdio.h
b. stdlib.h
c. conio.h
d. None of the above
9. Which of the following function is used to open a file in C++?
a. fopen
b. fclose
c. fgets
d. fseek
10. Which of the following should be used to free memory from a pointer
allocated using the “new” operator?
a. free()
b. delete
c. realloc()
d. none of the above
11. What will be the output of the following code snippet?
print(2**3 + (5 + 6)**(1 + 1))
a. 129
b. 0
c. 23
d. 12
12. What will be the type of the variable sorted_numbers in the below code
snippet?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
print(sorted_numbers)
e. list
f. tuple
g. sting
h. int
[Link] will be the output of the following code snippet?
a = [1, 2, 3]
a = tuple(a)
a[0] = 2
print(a)
a. [1,2,3]
b. [1,3,2]
c. [2,3,2]
d. error
14. What will be the output of the following code snippet?
a = [1, 2, 3, 4, 5]
sum = 0
for ele in a:
sum += ele
print(sum)
e. 15
f. 0
g. 20
h. none
15. What will be the output of the following code snippet?
def check(a):
print("Even" if a % 2 == 0 else "Odd")
check(12)
a. even
b. odd
c. error
d. none