CodeMavarick

CodeMavarick

University

20 Qs

quiz-placeholder

Similar activities

2da Práctica de reforzamiento Acv

2da Práctica de reforzamiento Acv

University

15 Qs

Teorías de la Competencia y Control

Teorías de la Competencia y Control

1st Grade - University

18 Qs

HOLA ESPERANCITA

HOLA ESPERANCITA

University

16 Qs

¿QUE APRENDISTE HOY EN BROMATOLOGIA?

¿QUE APRENDISTE HOY EN BROMATOLOGIA?

University

15 Qs

Podatki i ubezpieczenia

Podatki i ubezpieczenia

University

22 Qs

ISIL Idioma Extranjero I

ISIL Idioma Extranjero I

12th Grade - Professional Development

20 Qs

Lenguaje cinematográfico

Lenguaje cinematográfico

University

18 Qs

Deontología del Ingeniero civil

Deontología del Ingeniero civil

University

15 Qs

CodeMavarick

CodeMavarick

Assessment

Quiz

Other

University

Practice Problem

Hard

Created by

Harshit Nainwal

Used 5+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

  1. 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

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?