Search Header Logo

Programming Quiz on C

Authored by Santhoshi V

Computers

University

Used 2+ times

Programming Quiz on C
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the equivalent code of the following statement in WHILE LOOP format?

for (a=1; a<=100; a++)

printf ("%d\n", a * a);

a=1;

while (a<=100)

{

printf ("%d\n", a * a); a++;

}

a=0;

while (a<=100)

{

printf ("%d\n", a * a); a++;

}

a=1;

while (a>=100)

{

printf ("%d\n", a * a); a++;

}

while (a<=100)

{

printf ("%d\n", a * a); a++;

}

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of the following code?

for (a=1; a<=5; i++)

{

for (b=1; b<=a; b++)

printf("%d",b);

printf("\n");

}

1

1 2

1 2 3

1 2 3 4

1

2 2

3 3 3

4 4 4 4

5 5 5 5 5

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

None

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?

int main() {

char str[] = "Hello";

printf("%c", *(str + 1));

return 0;

}

H

e

l

o

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of the following code?

void fun(int *p) {

*p = *p + 10;

}

int main() {

int a = 5;

fun(&a);

printf("%d", a);

return 0;

}

5

10

15

Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

int main() {

int x = 10;

printf("%d %d %d", x++, x++, ++x);

return 0;

}

10 11 13

12 12 12

Undefined behavior

Compilation Error

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of the following code?int main() {

int x = 5, y = 10, z = 15;

int *arr[] = {&x, &y, &z};

printf("%d", *arr[1]);

return 0;

}

5

10

15

20

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of the following code?

int main() {

int a = 3, b = 4;

printf("%d", a+++b);

return 0;

}

7

8

3

Error

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?

Discover more resources for Computers