Available Questions About C Quizzes
1. How do you declare a structure in C?
struct Name { int age; };
struct Name { int age; }
struct Name { int age; };
struct Name { int age; }
2. Which of the following statements is true about arrays in C?
Array size must be specified at runtime.
Arrays in C are dynamically sized.
Array indices start from 1.
The size of an array must be known at compile time.
3. How do you include a standard library header file in C?
#include <header.h>
#include "header"
#include <header>
#include <header.h>
4. In C, what does the sizeof() operator return?
The number of elements in an array
The size of a variable or data type in bytes
The memory address of a variable
The total memory allocated to a program
5. Which operator is used to access the value of a variable through a pointer?
&
*
->
.
6. How do you declare a pointer to a function in C?
int *func();
int (*func)();
int (*func)();
int func*();
7. What is the size of an int on a 32-bit system?
2 bytes
4 bytes
8 bytes
16 bytes
8. Which of the following is used to dynamically allocate memory in C?
malloc()
alloc()
new()
calloc()
9. Which of the following statements about the static keyword in C is true?
static variables are local to the function in which they are defined but retain their value between function calls.
static variables are only accessible within the entire program.
static keyword can only be used for global variables.
static keyword is used to declare variables that are shared between different functions.
10. What does the sizeof() operator return when used on a pointer in C?
The size of the object pointed to by the pointer
The size of the pointer variable itself
The size of the memory block pointed to by the pointer
The total size of the array the pointer points to