C Programming Challenge

C Programming Challenge

12th Grade

15 Qs

quiz-placeholder

Similar activities

Greek & Latin Roots - Unit 4

Greek & Latin Roots - Unit 4

5th - 12th Grade

20 Qs

Types of Communicative Strategy

Types of Communicative Strategy

11th - 12th Grade

10 Qs

Root Word Practice

Root Word Practice

6th Grade - University

15 Qs

Root words 3/1

Root words 3/1

4th - 12th Grade

15 Qs

Latin Roots and Affixes

Latin Roots and Affixes

6th Grade - University

15 Qs

6th Grade Root Practice

6th Grade Root Practice

KG - University

20 Qs

Root Words & Context Clues

Root Words & Context Clues

7th - 12th Grade

15 Qs

We Shall Fight on the Beaches Deep Dive

We Shall Fight on the Beaches Deep Dive

12th Grade

18 Qs

C Programming Challenge

C Programming Challenge

Assessment

Quiz

English

12th Grade

Medium

Created by

Rahul undefined

Used 1+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax to declare a pointer in C?

int *ptr;

char *ptr;

double *ptr;

void *ptr;

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the difference between 'malloc' and 'calloc' functions in C.

malloc allocates uninitialized memory block, calloc allocates initialized memory block with all bits set to zero

malloc allocates memory in stack, calloc allocates memory in heap

malloc is used for allocating memory for arrays, calloc is used for allocating memory for variables

malloc and calloc are interchangeable functions in C

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you pass arguments by reference in C?

Pass the address of the variable as an argument to the function and dereference the pointer inside the function to access and modify the original variable.

Pass the value of the variable as an argument to the function

Use a global variable to pass arguments by reference

Pass a copy of the variable to the function

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'sizeof' operator in C?

To calculate the square root of a number

To convert a variable to a different data type

To determine the size in bytes of a data type or a variable.

To check if a variable is initialized

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the difference between 'while' and 'do-while' loops in C.

Both 'while' and 'do-while' loops have the same behavior

In 'while' loop, the condition is checked after executing the block of code

In 'while' loop, the condition is checked before executing the block of code, whereas in 'do-while' loop, the block of code is executed at least once before checking the condition.

In 'do-while' loop, the block of code is executed only if the condition is true

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the 'switch' statement used for in C?

It is used for creating loops in C.

It is used for defining variables in C.

It is used for multi-way branching based on the value of a variable or expression.

It is used for handling exceptions in C.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you dynamically allocate memory in C?

pointer_variable = (cast-type*) calloc(size);

pointer_variable = (cast-type*) malloc(size);

pointer_variable = (cast-type*) free(size);

pointer_variable = (cast-type*) realloc(size);

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?