C-Volution (Hard)

C-Volution (Hard)

University

10 Qs

quiz-placeholder

Similar activities

Contadores y Acumuladores

Contadores y Acumuladores

University

10 Qs

ITEC 70: Multimedia Quiz 1

ITEC 70: Multimedia Quiz 1

University

15 Qs

PPIS_2 Use Case

PPIS_2 Use Case

University

11 Qs

java2/67

java2/67

12th Grade - University

10 Qs

Survey DFT10173

Survey DFT10173

University

10 Qs

QUIZ 2 HTV

QUIZ 2 HTV

12th Grade - University

10 Qs

Module 5: Creating Dynamic Web Pages with Scripting

Module 5: Creating Dynamic Web Pages with Scripting

University

15 Qs

Artificial Intelligence: What's going on ?! Speedy Quiz !

Artificial Intelligence: What's going on ?! Speedy Quiz !

University

15 Qs

C-Volution (Hard)

C-Volution (Hard)

Assessment

Quiz

Information Technology (IT)

University

Practice Problem

Hard

Created by

Sujal Bhagat

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

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

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 3 pts

What is the output of the following code? #include int main() { int i, j; for (i = 1; i <= 5; i++) { for (j = 1; j <= i; j++) { printf("%d ", j); } printf("\n"); } return 0; }

1 1 2 1 2 3 1 2 3 4 1 2 3 4 5

1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

1 2 3 4 5 1 2 3 4 1 2 3 1 2 1

1 2 3 4 5 2 3 4 5 3 4 5 4 5 5

2.

MULTIPLE CHOICE QUESTION

1 min • 3 pts

What is the output of the following code? #include int main() { int i, j; for (i = 5; i >= 1; i--) { for (j = 1; j <= i; j++) { printf("*"); } printf("\n"); } return 0; }

***** **** *** ** *

* ** *** **** *****

***** **** *** ** *

* ** *** **** *****

3.

MULTIPLE CHOICE QUESTION

1 min • 3 pts

What is the error in the following code? #include int main() { int *ptr; *ptr = 10; printf("%d\n", *ptr); return 0;}

Missing #include directive.

Dereferencing an uninitialized pointer.

Incorrect format specifier in printf().

No error.

4.

MULTIPLE CHOICE QUESTION

1 min • 3 pts

What does the following code snippet do? #define SQUARE(x) x * x

Defines a function named SQUARE.

Defines a macro named SQUARE.

Declares a variable named SQUARE.

Includes a header file named SQUARE.

5.

MULTIPLE CHOICE QUESTION

1 min • 3 pts

What is the output of the following code? #include int main() { int i, j; for (i = 1; i <= 4; i++) { for (j = 1; j <= 4; j++) { if (i + j == 5) { printf("*"); } else { printf(" "); } } printf("\n"); } return 0; }

* * * * * * *

**** **** **** ****

* * * *

Nothing will be printed.

6.

MULTIPLE CHOICE QUESTION

1 min • 3 pts

What is the correct way to dynamically allocate memory for an array of 10 integers?

int *arr = malloc(10 * sizeof(int));

int *arr = calloc(10, sizeof(int));

int *arr = new int[10];

Both (a) and (b)

7.

MULTIPLE CHOICE QUESTION

1 min • 3 pts

What is the output of the following code? #include int main() { int i = 1; do { printf("%d ", i); i++; } while (i <= 5); printf("\n"); return 0; }

1 2 3 4 5

1 2 3 4 5 6

1 2 3 4

Infinite loop

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?