C Programming Quiz unit 2

C Programming Quiz unit 2

University

55 Qs

quiz-placeholder

Similar activities

Java Fundamentals Challenge

Java Fundamentals Challenge

University

53 Qs

Coading

Coading

University

60 Qs

DS and DAA Mock Quiz

DS and DAA Mock Quiz

University

50 Qs

22BCA6A-Quiz2-Java-File Handling

22BCA6A-Quiz2-Java-File Handling

University

56 Qs

BSIT2A Long Quiz OOP2

BSIT2A Long Quiz OOP2

University

60 Qs

Codex (Final assessment)

Codex (Final assessment)

University

51 Qs

J277/02 Computational thinking, algorithms and programming

J277/02 Computational thinking, algorithms and programming

9th Grade - University

56 Qs

Data Structures Quiz

Data Structures Quiz

University

50 Qs

C Programming Quiz unit 2

C Programming Quiz unit 2

Assessment

Quiz

Computers

University

Easy

Created by

MS CHAUHAN

Used 1+ times

FREE Resource

55 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the correct syntax for a for loop in C?

for (initialization; condition; increment) { ... }

for (condition; initialization; increment) { ... }

for initialization; condition; increment { ... }

for (initialization condition increment) { ... }

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How many times will the following loop execute? c int i = 0; while (i < 5) { i++; }

4

5

6

Infinite loop

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which statement should be used to skip the current iteration in a loop in C?

break;

continue;

goto;

exit;

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output for the following code? c for(int i=1; i<=3; i++) { for(int j=1; j<=i; j++) { printf("*"); } printf("\n"); }

text *** *** ***

text * ** ***

text * * *

text ** *** ****

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the valid declaration for a 2D integer array with 3 rows and 4 columns?

int arr[3][4];

int arr[4][3];

int arr[3];

int arr[4];

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How is the address of arr[i][j] in a 2D array (row-major order) calculated (assuming array is declared as int arr[M][N];)

base_address + (i*N + j) * sizeof(int)

base_address + (j*M + i) * sizeof(int)

base_address + (j*N + i) * sizeof(int)

base_address + (i*M + j) * sizeof(int)

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following correctly initializes a string in C?

char str[] = "Hello";

char str = "Hello";

Both A and B

char str = "Hello";

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?