Question: What will be the output of the following code snippet?
int arr[5] = {1, 2, 3, 4, 5};
printf("%d", arr[5]);
CodeMavarick
Quiz
•
Other
•
University
•
Hard
Harshit Nainwal
Used 5+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Question: What will be the output of the following code snippet?
int arr[5] = {1, 2, 3, 4, 5};
printf("%d", arr[5]);
5
0
Garbage Value
Compilation Error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of accessing an element in an array by its index?
O(1)
O(n)
O(log n)
O(n^2)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of the following code?
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
printf("Hello");
} }
O(n)
O(n log n)
O(n^2)
O(log n)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code do?
struct Node {
int data;
struct Node* next; };
struct Node* head = NULL;
head->data = 10;
Creates a node with data 10
Causes a segmentation fault
Initializes an empty linked list
Links two nodes
Answer explanation
head is NULL, so dereferencing it (head->data) causes a segmentation fault.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of inserting a node at the end of a singly linked list with no tail pointer?
O(1)
O(n)
O(n log n)
O(n^2)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Spot the error:
struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
newNode->data = 5;
newNode->next = newNode;
No error
Creates a circular reference
Missing free() call
Incorrect malloc syntax
Answer explanation
Setting newNode->next = newNode creates a circular linked list, which may not be intended.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many moves are required to solve the Tower of Hanoi puzzle with 5 disks?
32
16
31
25
15 questions
Quiz on Object Oriented Programming and Java
Quiz
•
University
20 questions
Tech quiz-july
Quiz
•
University
24 questions
Round 3: Coding Round
Quiz
•
University
20 questions
TECHTRIX2025 BUGHUNT SET1
Quiz
•
University
20 questions
Quiz Clash Sample
Quiz
•
University
23 questions
Lecture 2b: Solving Search Problems - Parte1
Quiz
•
University
15 questions
DEPTH DIVE
Quiz
•
University
15 questions
Arrays
Quiz
•
University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade