C Language Practice Test – 1 1. C language Practice Tests Which operator is used to perform a bitwise XOR operation in C? & | ^ ~ None 2. C language Practice Tests When should the volatile qualifier be used for a variable? When the variable's value can change outside the program flow, such as in hardware registers When you need to optimize variable access speed When you want the variable to be shared among different threads When you need to ensure the variable is not modified None 3. C language Practice Tests Which keyword prevents a function from being inlined by the compiler? inline noinline static extern None 4. C language Practice Tests What is the purpose of setjmp() in C? It saves the execution state for later restoration using longjmp() It sets the program counter to a specific address It initializes a new execution environment It jumps to a different code segment None 5. C language Practice Tests Which function is used to adjust the size of a previously allocated memory block? malloc() calloc() free() realloc() None 6. C language Practice Tests What does the sizeof operator return for an int on a 64-bit system? 2 bytes 4 bytes 8 bytes Depends on the compiler and platform None 7. C language Practice Tests How can you declare an array whose size is determined at runtime? int arr[10]; int arr[] = {1, 2, 3}; int arr[n]; int *arr; None 8. C language Practice Tests How do you compile a C source file into a shared library? gcc -shared -o library.so source.c gcc -static -o library source.c gcc -o library.so source.c gcc -lib -o library source.c None 9. C language Practice Tests Which syntax is correct for declaring a pointer to a function that returns an int? int (*func_ptr)(); int func_ptr*(); int func_ptr(); int *func_ptr(); None 10. C language Practice Tests What effect does the static keyword have on a variable within a function? The variable retains its value across function calls The variable is only accessible within the file The variable is initialized to zero automatically The variable's value cannot be changed after initialization None Time's up