Computer Science MCQs · C Programming In C, a variable of type char typically occupies: A 4 bytes B 8 bytes C 1 byte Correct answer D 2 bytes MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming If x = 5, what is the value of x after the statement y = x++;? A 5 B 4 C 7 D 6 Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which operator in C is the conditional (ternary) operator? A && B || C ?? D ?: Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming The function fopen() returns: A the file size B a FILE pointer Correct answer C an integer file descriptor only D a character buffer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming The value of an uninitialised automatic (local) variable in C is: A indeterminate garbage Correct answer B always zero C always NULL D a compile-time error MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming The continue statement in a loop: A exits the loop entirely at once and moves on B jumps to the end of the current function call body C resets the loop counter back to zero again D skips the remaining statements of the current iteration Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming The break statement inside a loop causes control to: A exit the innermost loop or switch immediately Correct answer B skip only the current iteration of the loop C restart the loop from its very beginning D terminate the whole program at once MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming A recursive function must always have: A a base case that stops the recursion Correct answer B a global variable declared outside C a return type of void D at least two formal parameters MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which operator is used to access a member of a structure variable? A :: B * C . Correct answer D -> MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which header declares strcpy() and strcmp()? A string.h Correct answer B stdio.h C stdlib.h D ctype.h MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming In C, a string is terminated by: A the null character '\0' Correct answer B a newline character C a space character D the character 'EOF' MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which operator is used to obtain the address of a variable in C? A -> B . C & Correct answer D * MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which format specifier is used in printf() to display a float value? A %f Correct answer B %d C %c D %s MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming The function strlen() returns: A the number of characters excluding the null terminator Correct answer B the number of characters including the null terminator C the size of the allocated buffer D the number of words in a string MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming The free() function is used to: A clear the terminal screen B release dynamically allocated memory Correct answer C delete a file permanently from disk D close an open file handle MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming The function malloc() is declared in which header file? A stdio.h B malloc.h C memory.h D stdlib.h Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming A pointer variable in C stores: A the size of a variable B a function name C a memory address Correct answer D a copy of the data itself MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming The index of the first element of an array in C is: A 0 Correct answer B 1 C −1 D the array name MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which header file must be included to use printf() and scanf()? A stdlib.h B string.h C math.h D stdio.h Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming In a typical 32-bit C implementation, what is sizeof(int)? A 4 bytes Correct answer B 2 bytes C 8 bytes D 1 byte MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which storage class in C keeps a local variable alive for the entire program? A extern B register C static Correct answer D auto MCQSEXAM Show answer Read explanation