
C programming
Quiz by Smriti Srivastava
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Measure skills
from any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
10 questions
Show answers
- Q1What is the purpose of the 'return' statement in a function in C?To loop through codeTo pause the programTo declare variablesTo exit the function and optionally return a value30s
- Q2What does the 'sizeof' operator return in C?The number of elements in an arrayThe size, in bytes, of a data type or variableThe memory address of a variableThe type of a variable30s
- Q3In C, what is the correct way to declare a function that takes two integers as parameters and returns their sum as an integer?int add(int a)int add(int a, int b)int add(a, b)void add(int a, int b)30s
- Q4What function is used to read a string from standard input in C?printfgetsfgetsscanf30s
- Q5What will be the output of the following C code: printf("%d", 10 + 20 / 4);?2030101530s
- Q6Which operator is used to access members of a structure in C?*.->&30s
- Q7What is the correct way to allocate memory dynamically for an array of 10 integers in C?int arr[10];int *arr = malloc(10);int *arr = (int *)calloc(10);int *arr = (int *)malloc(10 * sizeof(int));30s
- Q8What keyword is used to define a constant value in C?constantdefinestaticconst30s
- Q9What will happen if you try to use an uninitialized pointer in C?It will point to the stack memory.It will always point to the first element of an array.It will automatically be initialized to NULL.It may lead to undefined behavior.30s
- Q10Which function is used to terminate a program in C?terminatecloseexitstop30s