C Programming

C Programming

University

12 Qs

quiz-placeholder

Similar activities

Spanish Past tense

Spanish Past tense

1st Grade - University

10 Qs

EFFECTIVE GROUP DISCUSSION

EFFECTIVE GROUP DISCUSSION

9th Grade - University

10 Qs

Business Ethics

Business Ethics

University

10 Qs

BTS

BTS

University

10 Qs

Seminario de úlceras

Seminario de úlceras

University

10 Qs

random things

random things

KG - Professional Development

14 Qs

CU 3 TAHAP 2 (PENILAIAN PENGETAHUAN)1

CU 3 TAHAP 2 (PENILAIAN PENGETAHUAN)1

University

10 Qs

Presenting and Analysing Data

Presenting and Analysing Data

University

11 Qs

C Programming

C Programming

Assessment

Quiz

Other

University

Practice Problem

Hard

Created by

Kavinaya R

FREE Resource

AI

Enhance your content in a minute

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

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What does this code print?

char str[] = "World";

str[2] = 'r';

printf("%s", str);

World

Wrrld

Worrd

Worrld

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What happens here?

char str[] = "Hi";

str[2] = '!';

printf("%s", str);

Hi

Hi!

H!i

Undefined` or garbage value

Answer explanation

you're overwriting the null terminator — risky behavior!

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

`What does this function compute?

int fun(int n) {

if (n == 0) return 0;

return n + fun(n - 1);

}

Multiplication Table

Sum of n natural number

Factorial

Fibonacci

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What does this function do?

void fun(int n) {

if (n == 0) return;

fun(n - 1);

printf("%d ", n);

}

Prints numbers in reverse

Prints from 1 to n

Infinite loop

Compilation error

Answer explanation

Recursion goes down to 0, then prints as it comes back

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this loop do?

for (int i = 1; i <= 3; i++) {

printf("Loop\n");

}

Prints “Loop” 1 time

Prints “Loop” 3 times

Infinite loop

Error

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will this pattern print?

for (int i = 1; i <= 3; i++) {

for (int j = 1; j <= i; j++) {

printf("*");

}

printf("\n");

}

*** **

*

*

**

***

1

2

3

***

***

***

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What does this pattern print?

for (int i = 1; i <= 3; i++) {

for (int j = 1; j <= 3; j++) {

printf("%d", j);

}

printf("\n");

}

123

123

123

111

222

333

321

321

321

123

234

345

Create a free account and access millions of resources

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?