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
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Season 5 #Spaic Python Weekly Quiz

Quiz
•
KG - Professional Dev...
20 questions
Konsep Struktur Data

Quiz
•
University
15 questions
Αντικειμενοστραφής Προγραμματισμός TEST

Quiz
•
University
20 questions
Quanta

Quiz
•
University
20 questions
Android Club Event-1

Quiz
•
University
15 questions
Comprendre les listes chainées en C

Quiz
•
University
20 questions
QUIZ WEEK 6

Quiz
•
University
15 questions
Tech quiz Round 1

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Other
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University