Mastering C Programming Concepts

Mastering C Programming Concepts

University

20 Qs

quiz-placeholder

Similar activities

A2 13.1 L1 User defined data types

A2 13.1 L1 User defined data types

12th Grade - University

20 Qs

Data Structure Quiz-1

Data Structure Quiz-1

University

22 Qs

Queue ADT

Queue ADT

12th Grade - University

20 Qs

C++ Bootcamp 2k24

C++ Bootcamp 2k24

University

20 Qs

revision

revision

University

17 Qs

CSI Coding Quiz

CSI Coding Quiz

University

20 Qs

Orientation Session

Orientation Session

University

15 Qs

Stack and Queue

Stack and Queue

University

15 Qs

Mastering C Programming Concepts

Mastering C Programming Concepts

Assessment

Quiz

Computers

University

Medium

Created by

Pushpendra Pateriya

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

for(initialization: condition: increment) { // code }

for(initialization; increment; condition) { // code }

for(initialization; condition; increment) { // code }

for(condition; initialization; increment) { // code }

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write a simple while loop that prints numbers from 1 to 5.

i = 1 while i <= 5: print(i) i += 1

for i in range(1, 6): print(i)

i = 0 while i < 5: print(i) i += 1

i = 1 while i < 5: print(i) i += 1

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you use an if-else statement to check if a number is positive or negative?

Use an if-else statement to compare the number to zero.

Use a loop to iterate through the number.

Check if the number is greater than one.

Use a switch statement to check the number.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the purpose of nested if conditions with an example.

To determine if a student should retake the exam based on their attendance.

For example, in a grading system, if a student's score is above 60 (outer if), then check if the score is above 80 (inner if) to determine if they receive a distinction.

To check if a student's score is below 50 for a passing grade.

To calculate the average score of all students in the class.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax of a switch case statement in C?

switch(expression) { case constant1: // statements; case constant2: // statements; }

switch { case constant1: // statements break; case constant2: // statements break; }

switch(expression) { case constant1: // statements break; case constant2: // statements break; default: // statements }

switch(expression) { case constant1: // statements; default: // statements; }

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you use pointers to access members of a structure?

Use the dot operator (.) with a pointer to access structure members.

Access structure members directly without using pointers.

Use the asterisk operator (*) to dereference and access structure members.

Use the arrow operator (->) with a pointer to access structure members.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a pointer in C and how is it declared?

A pointer in C is declared with 'pointerName : type;'

A pointer in C is a variable that holds a string value.

A pointer in C is declared using the syntax 'type *pointerName;', for example, 'int *ptr;'

A pointer in C is declared using 'type pointerName;'

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?