Quiz 1:

What does the acronym ‘ASCII’ stand for in C programming?

  1. HyperText Markup Language (HTML)
  2. American Standard Code for Information Interchange (ASCII)
  3. Advanced Structured Coding Interface (ASCI)
  4. Automated System for Code Integration (ASCI)

Correct Answer: 2. American Standard Code for Information Interchange (ASCII)

Explanation: ASCII is a character encoding standard that represents text in computers, communications equipment, and other devices.


Quiz 2:

In C, which keyword is used to define a constant?

  1. var
  2. define
  3. constant
  4. const

Correct Answer: 4. const

Explanation: The const keyword is used to define constants in C, making the value unmodifiable.


Quiz 3:

What is the purpose of the ‘break’ statement in a switch-case statement?

  1. Skip the current iteration
  2. Exit the loop
  3. Terminate the program
  4. Exit the switch block

Correct Answer: 4. Exit the switch block

Explanation: The ‘break’ statement is used to exit the switch block once a matching case is found.


Quiz 4:

Which operator is used for dynamic memory allocation in C?

  1. new
  2. malloc
  3. alloc
  4. allocate

Correct Answer: 2. malloc

Explanation: The malloc function is used to allocate memory dynamically in C.


Quiz 5:

What does the ‘sizeof’ operator return in C?

  1. Size of a variable
  2. Size of a function
  3. Size of a pointer
  4. Size of a constant

Correct Answer: 1. Size of a variable

Explanation: The ‘sizeof’ operator returns the size, in bytes, of the specified variable or data type.


Quiz 6:

Which header file should be included to use the ‘printf’ function in C?

  1. input.h
  2. output.h
  3. stdio.h
  4. stdlib.h

Correct Answer: 3. stdio.h

Explanation: The ‘printf’ function is part of the Standard Input/Output library in C, and the header file stdio.h should be included.


Quiz 7:

What is the role of the ‘void’ keyword in a function declaration?

  1. Specifies the return type
  2. Represents an empty function
  3. Declares a variable
  4. Indicates a pointer type

Correct Answer: 1. Specifies the return type

Explanation: The ‘void’ keyword is used to indicate that a function does not return any value.


Quiz 8:

Which of the following is the correct way to comment out multiple lines in C?

  1. # Comment #
  2. /* Comment */
  3. // Comment
  4. % Comment %

Correct Answer: 2. /* Comment */

Explanation: Multiple-line comments in C are enclosed between /* and */.


Quiz 9:

What is the purpose of the ‘typedef’ keyword in C?

  1. Declare a new type name
  2. Define a constant
  3. Specify the data type of a variable
  4. Allocate memory dynamically

Correct Answer: 1. Declare a new type name

Explanation: ‘typedef’ is used to create a new type name for an existing data type.


Quiz 10:

Which function is used to read a character from the standard input in C?

  1. getchar()
  2. readchar()
  3. scanchar()
  4. read()

Correct Answer: 1. getchar()

Explanation: getchar() is used to read a single character from the standard input (keyboard).


Quiz 11:

What is the purpose of the ‘strcmp’ function in C?

  1. Concatenate two strings
  2. Compare two strings
  3. Convert a string to uppercase
  4. Find the length of a string

Correct Answer: 2. Compare two strings

Explanation: The ‘strcmp’ function is used to compare two strings in C.


Quiz 12:

Which loop is known as an entry-controlled loop in C?

  1. for loop
  2. while loop
  3. do-while loop
  4. if loop

Correct Answer: 1. for loop

Explanation: The for loop is an entry-controlled loop in C.


Quiz 13:

In C, how are single-line comments denoted?

  1. // Comment
  2. /* Comment */
  3. # Comment #
  4. ! Comment !

Correct Answer: 1. // Comment

Explanation: Single-line comments in C are indicated by //.


Quiz 14:

Which escape sequence is used for a new line in C?

  1. \n
  2. \r
  3. \t
  4. \a

Correct Answer: 1. \n

Explanation: \n represents a new line character in C.


Quiz 15:

What is the purpose of the ‘do-while’ loop in C?

  1. Execute a block of code while a condition is true
  2. Execute a block of code at least once
  3. Loop through an array
  4. Iterate over a range of values

Correct Answer: 2. Execute a block of code at least once

Explanation: The ‘do-while’ loop ensures that the code block is executed at least once, even if the condition is false.


Quiz 16:

Which bitwise operator is used to set a particular bit to 1 in C?

  1. &
  2. |
  3. ^
  4. << 

Correct Answer: 2. |

Explanation: The bitwise OR (|) operator is used to set a particular bit to 1.


Quiz 17:

What is the purpose of the ‘return’ statement in a function in C?

  1. Exit the program
  2. Return a value from the function
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Return a value from the function

Explanation: The ‘return’ statement is used to send a value back from a function.


Quiz 18:

Which data type is used to store a single character in C?

  1. int
  2. float
  3. char
  4. double

Correct Answer: 3. char

Explanation: The char data type is used to store a single character in C.


Quiz 19:

What is the purpose of the ‘continue’ statement in a loop in C?

  1. Skip the current iteration and move to the next
  2. Exit the loop
  3. Terminate the program
  4. Restart the loop from the beginning

Correct Answer: 1. Skip the current iteration and move to the next

Explanation: The ‘continue’ statement is used to skip the rest of the code inside a loop for the current iteration and move to the next one.


Quiz 20:

Which function is used to close a file in C?

  1. fclose()
  2. close()
  3. fileclose()
  4. shutfile()

Correct Answer: 1. fclose()

Explanation: The fclose() function is used to close a file in C after performing file operations.


Quiz 21:

Which of the following is the correct syntax for a structure declaration in C?

  1. structure MyStruct { /* members */ };
  2. struct MyStruct { /* members */ };
  3. type MyStruct { /* members */ };
  4. new struct MyStruct { /* members */ };

Correct Answer: 2. struct MyStruct { /* members */ };

Explanation: The correct syntax for a structure declaration in C is struct MyStruct { /* members */ };.


Quiz 22:

What is the purpose of the ‘sizeof’ operator in C?

  1. Return the size of a function
  2. Return the size of a pointer
  3. Return the size of a variable or data type
  4. Return the size of a constant

Correct Answer: 3. Return the size of a variable or data type

Explanation: The ‘sizeof’ operator in C is used to determine the size, in bytes, of a variable or data type.


Quiz 23:

Which operator is used for logical AND in C?

  1. &&
  2. ||
  3. !
  4. &

Correct Answer: 1. &&

Explanation: The && operator is used for logical AND in C.


Quiz 24:

In C, what is the purpose of the ‘void’ data type?

  1. Specify an empty variable
  2. Indicate the absence of a data type
  3. Define a constant value
  4. Represent a generic pointer type

Correct Answer: 2. Indicate the absence of a data type

Explanation: The ‘void’ data type in C is used to indicate the absence of a specific data type.


Quiz 25:

Which function is used to concatenate two strings in C?

  1. strcat()
  2. concat()
  3. merge()
  4. append()

Correct Answer: 1. strcat()

Explanation: The strcat() function in C is used to concatenate two strings.


Quiz 26:

What is the purpose of the ‘if’ statement in C?

  1. Iterate over a range of values
  2. Make decisions based on a condition
  3. Declare a variable
  4. Perform file operations

Correct Answer: 2. Make decisions based on a condition

Explanation: The ‘if’ statement in C is used to make decisions based on a specified condition.


Quiz 27:

Which operator is used for pointer dereferencing in C?

  1. *
  2. &
  3. ->
  4. %

Correct Answer: 1. *

Explanation: The * operator is used for pointer dereferencing in C.


Quiz 28:

What is the purpose of the ‘calloc’ function in C?

  1. Allocate memory dynamically
  2. Initialize memory to zero
  3. Free allocated memory
  4. Allocate memory for an array of elements

Correct Answer: 4. Allocate memory for an array of elements

Explanation: The ‘calloc’ function in C is used to allocate memory for an array of elements and initializes the memory to zero.


Quiz 29:

Which loop is known as an exit-controlled loop in C?

  1. do-while loop
  2. while loop
  3. for loop
  4. if loop

Correct Answer: 2. while loop

Explanation: The while loop is an exit-controlled loop in C.


Quiz 30:

What is the purpose of the ‘union’ keyword in C?

  1. Declare a new type name
  2. Represent a collection of variables
  3. Create an empty function
  4. Allocate memory dynamically

Correct Answer: 2. Represent a collection of variables

Explanation: The ‘union’ keyword in C is used to represent a collection of variables that share the same memory location.


Quiz 31:

Which header file should be included to use the ‘scanf’ function in C?

  1. input.h
  2. output.h
  3. stdio.h
  4. stdlib.h

Correct Answer: 3. stdio.h

Explanation: The ‘scanf’ function is part of the Standard Input/Output library in C, and the header file stdio.h should be included.


Quiz 32:

What is the purpose of the ‘for’ loop in C?

  1. Execute a block of code at least once
  2. Iterate over a range of values
  3. Make decisions based on a condition
  4. Skip the current iteration and move to the next

Correct Answer: 2. Iterate over a range of values

Explanation: The ‘for’ loop in C is used to iterate over a range of values with a specified control structure.


Quiz 33:

Which operator is used for the modulo operation in C?

  1. %
  2. &
  3. |
  4. ^

Correct Answer: 1. %

Explanation: The % operator is used for the modulo operation in C, which returns the remainder of a division.


Quiz 34:

What does the ‘sizeof’ operator return when used with a pointer in C?

  1. Size of the pointer variable
  2. Size of the data type to which the pointer points
  3. Total size of the memory allocated for the pointer
  4. Size of the memory address held by the pointer

Correct Answer: 1. Size of the pointer variable

Explanation: When used with a pointer, the ‘sizeof’ operator in C returns the size of the pointer variable.


Quiz 35:

Which function is used to open a file in C for writing?

  1. fopen(“filename”, “r”)
  2. fopen(“filename”, “w”)
  3. fopen(“filename”, “a”)
  4. fopen(“filename”, “rb”)

Correct Answer: 2. fopen(“filename”, “w”)

Explanation: The fopen function with mode “w” is used to open a file in C for writing.


Quiz 36:

In C, what is the purpose of the ‘else’ statement?

  1. Declare a variable
  2. Specify an alternative block of code
  3. Loop through an array
  4. Terminate the program

Correct Answer: 2. Specify an alternative block of code

Explanation: The ‘else’ statement in C is used to specify an alternative block of code to be executed when the ‘if’ condition is false.


Quiz 37:

Which data type is used to store whole numbers in C?

  1. int
  2. float
  3. char
  4. double

Correct Answer: 1. int

Explanation: The int data type is used to store whole numbers in C.


Quiz 38:

What is the purpose of the ‘free’ function in C?

  1. Allocate memory dynamically
  2. Initialize memory to zero
  3. Deallocate memory
  4. Allocate memory for an array of elements

Correct Answer: 3. Deallocate memory

Explanation: The ‘free’ function in C is used to deallocate memory that was previously allocated dynamically using functions like ‘malloc’ or ‘calloc’.


Quiz 39:

Which header file should be included to use the ‘strlen’ function in C?

  1. string.h
  2. stdio.h
  3. stdlib.h
  4. math.h

Correct Answer: 1. string.h

Explanation: The ‘strlen’ function is part of the string manipulation functions in C, and the header file string.h should be included.


Quiz 40:

What is the purpose of the ‘goto’ statement in C?

  1. Exit the program
  2. Jump to a specified label within the program
  3. Make decisions based on a condition
  4. Loop through an array

Correct Answer: 2. Jump to a specified label within the program

Explanation: The ‘goto’ statement in C is used to transfer control to a specified label within the program.


Quiz 41:

Which operator is used for bitwise left shift in C?

  1. << 
  2. >> 
  3. &
  4. |

Correct Answer: 1. <<

Explanation: The << operator is used for bitwise left shift in C, which shifts the bits to the left.


Quiz 42:

What is the role of the ‘include’ directive in C?

  1. Define a new function
  2. Include external files in the program
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Include external files in the program

Explanation: The ‘include’ directive in C is used to include external files in the program, often header files containing declarations.


Quiz 43:

Which of the following is the correct syntax for a function declaration in C?

  1. function MyFunction() { /* code */ }
  2. def MyFunction(): pass
  3. void MyFunction() { /* code */ }
  4. int MyFunction(int param);

Correct Answer: 4. int MyFunction(int param);

Explanation: The correct syntax for a function declaration in C includes the return type, function name, and parameter list.


Quiz 44:

What is the purpose of the ‘switch’ statement in C?

  1. Loop through a range of values
  2. Make decisions based on multiple conditions
  3. Create an infinite loop
  4. Define a constant value

Correct Answer: 2. Make decisions based on multiple conditions

Explanation: The ‘switch’ statement in C is used to make decisions based on the values of an expression.


Quiz 45:

Which of the following is the correct way to declare a pointer in C?

  1. int ptr;
  2. pointer int;
  3. int *ptr;
  4. ptr int;

Correct Answer: 3. int *ptr;

Explanation: The correct way to declare a pointer in C is by placing the asterisk (*) before the variable name.


Quiz 46:

In C, what is the role of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 47:

Which function is used to convert a string to an integer in C?

  1. atoi()
  2. itoa()
  3. strtoi()
  4. intToStr()

Correct Answer: 1. atoi()

Explanation: The atoi() function in C is used to convert a string to an integer.


Quiz 48:

What is the purpose of the ‘const’ keyword in a function declaration in C?

  1. Specify the return type
  2. Declare a constant variable
  3. Define a constant value
  4. Indicate a variable parameter

Correct Answer: 4. Indicate a variable parameter

Explanation: The ‘const’ keyword in a function declaration is used to indicate that a parameter is a constant.


Quiz 49:

Which of the following is a valid way to initialize an array in C?

  1. int myArray = {1, 2, 3};
  2. int myArray[] = {1, 2, 3};
  3. myArray = {1, 2, 3};
  4. int myArray[3] = {1, 2, 3};

Correct Answer: 2. int myArray[] = {1, 2, 3};

Explanation: The correct syntax for initializing an array in C is to use curly braces {} with the values enclosed.


Quiz 50:

What is the purpose of the ‘volatile’ keyword in C?

  1. Declare a constant value
  2. Specify the return type of a function
  3. Indicate that a variable may be changed at any time
  4. Create a dynamic variable

Correct Answer: 3. Indicate that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 51:

Which function is used to write a character to the standard output in C?

  1. putchar()
  2. writechar()
  3. printchar()
  4. displaychar()

Correct Answer: 1. putchar()

Explanation: The putchar() function in C is used to write a character to the standard output (usually the console).


Quiz 52:

What is the purpose of the ‘rand()’ function in C?

  1. Allocate memory dynamically
  2. Generate a random number
  3. Return the square root of a number
  4. Convert a string to uppercase

Correct Answer: 2. Generate a random number

Explanation: The ‘rand()’ function in C is used to generate a pseudo-random integer.


Quiz 53:

In C, how can you declare a constant variable?

  1. const var = 5;
  2. constant int var = 5;
  3. var const = 5;
  4. int const var = 5;

Correct Answer: 4. int const var = 5;

Explanation: To declare a constant variable in C, use the ‘const’ keyword before the data type.


Quiz 54:

Which operator is used for pointer arithmetic in C?

  1. +
  2. *
  3. /

Correct Answer: 2. –

Explanation: The – operator is used for pointer arithmetic in C to find the difference between two pointers.


Quiz 55:

What is the purpose of the ‘do-while’ loop in C?

  1. Iterate over a range of values
  2. Make decisions based on a condition
  3. Execute a block of code at least once
  4. Create an infinite loop

Correct Answer: 3. Execute a block of code at least once

Explanation: The ‘do-while’ loop in C ensures that the code block is executed at least once, even if the condition is false.


Quiz 56:

Which header file should be included to use the ‘abs’ function in C for absolute value?

  1. stdlib.h
  2. math.h
  3. stdio.h
  4. limits.h

Correct Answer: 1. stdlib.h

Explanation: The ‘abs’ function for absolute value is part of the stdlib.h (standard library) in C.


Quiz 57:

What does the ‘static’ keyword do when applied to a variable in C?

  1. Allocates memory dynamically
  2. Declares a constant value
  3. Extends the variable’s scope to the entire program
  4. Specifies that the variable is not modifiable

Correct Answer: 3. Extends the variable’s scope to the entire program

Explanation: The ‘static’ keyword, when applied to a variable in C, extends its scope to the entire program.


Quiz 58:

Which of the following is a valid way to open a file in C for reading and writing?

  1. fopen(“file.txt”, “r”)
  2. fopen(“file.txt”, “w”)
  3. fopen(“file.txt”, “rw”)
  4. fopen(“file.txt”, “a+”)

Correct Answer: 4. fopen(“file.txt”, “a+”)

Explanation: The mode “a+” in fopen is used to open a file in C for reading and writing, with the file positioned at the end initially.


Quiz 59:

What is the purpose of the ‘continue’ statement in a loop in C?

  1. Skip the current iteration and move to the next
  2. Exit the loop
  3. Terminate the program
  4. Restart the loop from the beginning

Correct Answer: 1. Skip the current iteration and move to the next

Explanation: The ‘continue’ statement in C is used to skip the rest of the code inside a loop for the current iteration and move to the next one.


Quiz 60:

Which data type is used to store decimal numbers with single precision in C?

  1. float
  2. double
  3. long double
  4. decimal

Correct Answer: 1. float

Explanation: The float data type in C is used to store decimal numbers with single precision.


Quiz 61:

Which header file should be included to use the ‘pow’ function in C for exponentiation?

  1. math.h
  2. stdio.h
  3. stdlib.h
  4. power.h

Correct Answer: 1. math.h

Explanation: The ‘pow’ function for exponentiation is part of the math.h (mathematics) library in C.


Quiz 62:

What is the purpose of the ‘getchar’ function in C?

  1. Read a character from the standard input
  2. Print a character to the standard output
  3. Return a character from a function
  4. Initialize a character variable

Correct Answer: 1. Read a character from the standard input

Explanation: The getchar function in C is used to read a single character from the standard input (usually the keyboard).


Quiz 63:

In C, what is the purpose of the ‘sizeof’ operator when used with a data type?

  1. Return the size of a variable
  2. Return the size of a constant
  3. Return the size of a pointer
  4. Return the size of the specified data type

Correct Answer: 4. Return the size of the specified data type

Explanation: The ‘sizeof’ operator in C, when used with a data type, returns the size, in bytes, of the specified data type.


Quiz 64:

Which operator is used for logical OR in C?

  1. &&
  2. ||
  3. !
  4. |

Correct Answer: 2. ||

Explanation: The || operator is used for logical OR in C.


Quiz 65:

What is the purpose of the ‘fwrite’ function in C?

  1. Read from a file
  2. Write to a file
  3. Copy one file to another
  4. Close a file

Correct Answer: 2. Write to a file

Explanation: The ‘fwrite’ function in C is used to write data to a file.


Quiz 66:

Which function is used to convert a character to its ASCII value in C?

  1. charToAscii()
  2. asciify()
  3. char()
  4. int()

Correct Answer: 4. int()

Explanation: To convert a character to its ASCII value in C, you can use an explicit type cast like int(character).


Quiz 67:

What is the purpose of the ‘strcat’ function in C?

  1. Compare two strings
  2. Copy one string to another
  3. Concatenate two strings
  4. Find the length of a string

Correct Answer: 3. Concatenate two strings

Explanation: The ‘strcat’ function in C is used to concatenate (append) two strings.


Quiz 68:

Which of the following is the correct syntax for declaring a structure in C?

  1. struct MyStruct { /* members */ };
  2. structure MyStruct { /* members */ };
  3. type MyStruct { /* members */ };
  4. new struct MyStruct { /* members */ };

Correct Answer: 1. struct MyStruct { /* members */ };

Explanation: The correct syntax for declaring a structure in C is struct MyStruct { /* members */ };.


Quiz 69:

What does the ‘volatile’ keyword do when applied to a variable in C?

  1. Declares a constant value
  2. Extends the variable’s scope to the entire program
  3. Specifies that the variable is not modifiable
  4. Indicates that a variable may be changed at any time

Correct Answer: 4. Indicates that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 70:

Which operator is used for pointer dereferencing in C?

  1. *
  2. &
  3. ->
  4. %

Correct Answer: 1. *

Explanation: The * operator is used for pointer dereferencing in C.


Quiz 71:

What is the purpose of the ‘const’ keyword in C when applied to a pointer?

  1. Indicates a constant value
  2. Specifies that the pointer cannot be modified
  3. Declares a constant pointer
  4. Specifies that the pointed-to value is constant

Correct Answer: 4. Specifies that the pointed-to value is constant

Explanation: When ‘const’ is applied to a pointer in C, it indicates that the pointed-to value is constant and cannot be modified through that pointer.


Quiz 72:

Which function is used to allocate memory for an array dynamically in C?

  1. malloc()
  2. calloc()
  3. realloc()
  4. alloc()

Correct Answer: 2. calloc()

Explanation: The calloc() function in C is used to dynamically allocate memory for an array and initializes the allocated memory to zero.


Quiz 73:

What is the purpose of the ‘strlen’ function in C?

  1. Concatenate two strings
  2. Compare two strings
  3. Find the length of a string
  4. Copy one string to another

Correct Answer: 3. Find the length of a string

Explanation: The ‘strlen’ function in C is used to determine the length (number of characters) of a string.


Quiz 74:

Which operator is used for bitwise AND in C?

  1. &
  2. |
  3. ^
  4. << 

Correct Answer: 1. &

Explanation: The & operator is used for bitwise AND in C.


Quiz 75:

What is the purpose of the ‘return’ statement in a function in C?

  1. Exit the program
  2. Return a value from the function
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Return a value from the function

Explanation: The ‘return’ statement in C is used to send a value back from a function.


Quiz 76:

Which function is used to close a file in C?

  1. fclose()
  2. close()
  3. fileclose()
  4. shutfile()

Correct Answer: 1. fclose()

Explanation: The fclose() function is used to close a file in C after performing file operations.


Quiz 77:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 78:

What is the purpose of the ‘typedef’ keyword in C?

  1. Declare a new type name
  2. Define a constant value
  3. Specify the return type of a function
  4. Create an alias for a variable

Correct Answer: 1. Declare a new type name

Explanation: The ‘typedef’ keyword in C is used to create a new type name for an existing data type.


Quiz 79:

Which of the following is the correct syntax for a function definition in C?

  1. def myFunction(): pass
  2. int myFunction() { /* code */ }
  3. void myFunction() { /* code */ }
  4. int myFunction(parameters) { /* code */ }

Correct Answer: 4. int myFunction(parameters) { /* code */ }

Explanation: The correct syntax for a function definition in C includes the return type, function name, parameters, and the function body.


Quiz 80:

What is the purpose of the ‘union’ keyword in C?

  1. Declare a new type name
  2. Represent a collection of variables
  3. Create an empty function
  4. Allocate memory dynamically

Correct Answer: 2. Represent a collection of variables

Explanation: The ‘union’ keyword in C is used to represent a collection of variables that share the same memory location.


Quiz 81:

Which header file should be included to use the ‘scanf’ function in C?

  1. input.h
  2. output.h
  3. stdio.h
  4. stdlib.h

Correct Answer: 3. stdio.h

Explanation: The ‘scanf’ function is part of the Standard Input/Output library in C, and the header file stdio.h should be included.


Quiz 82:

What is the purpose of the ‘for’ loop in C?

  1. Execute a block of code at least once
  2. Iterate over a range of values
  3. Make decisions based on a condition
  4. Skip the current iteration and move to the next

Correct Answer: 2. Iterate over a range of values

Explanation: The ‘for’ loop in C is used to iterate over a range of values with a specified control structure.


Quiz 83:

Which operator is used for the modulo operation in C?

  1. %
  2. &
  3. |
  4. ^

Correct Answer: 1. %

Explanation: The % operator is used for the modulo operation in C, which returns the remainder of a division.


Quiz 84:

What does the ‘sizeof’ operator return when used with a pointer in C?

  1. Size of the pointer variable
  2. Size of the data type to which the pointer points
  3. Total size of the memory allocated for the pointer
  4. Size of the memory address held by the pointer

Correct Answer: 1. Size of the pointer variable

Explanation: When used with a pointer, the ‘sizeof’ operator in C returns the size of the pointer variable.


Quiz 85:

Which function is used to open a file in C for writing?

  1. fopen(“filename”, “r”)
  2. fopen(“filename”, “w”)
  3. fopen(“filename”, “a”)
  4. fopen(“filename”, “rb”)

Correct Answer: 2. fopen(“filename”, “w”)

Explanation: The fopen function with mode “w” is used to open a file in C for writing.


Quiz 86:

In C, what is the purpose of the ‘else’ statement?

  1. Declare a variable
  2. Specify an alternative block of code
  3. Loop through an array
  4. Terminate the program

Correct Answer: 2. Specify an alternative block of code

Explanation: The ‘else’ statement in C is used to specify an alternative block of code to be executed when the ‘if’ condition is false.


Quiz 87:

Which data type is used to store whole numbers in C?

  1. int
  2. float
  3. char
  4. double

Correct Answer: 1. int

Explanation: The int data type is used to store whole numbers in C.


Quiz 88:

What is the purpose of the ‘free’ function in C?

  1. Allocate memory dynamically
  2. Initialize memory to zero
  3. Deallocate memory
  4. Allocate memory for an array of elements

Correct Answer: 3. Deallocate memory

Explanation: The ‘free’ function in C is used to deallocate memory that was previously allocated dynamically using functions like ‘malloc’ or ‘calloc’.


Quiz 89:

Which header file should be included to use the ‘strlen’ function in C?

  1. string.h
  2. stdio.h
  3. stdlib.h
  4. math.h

Correct Answer: 1. string.h

Explanation: The ‘strlen’ function is part of the string manipulation functions in C, and the header file string.h should be included.


Quiz 90:

What is the purpose of the ‘goto’ statement in C?

  1. Exit the program
  2. Jump to a specified label within the program
  3. Make decisions based on a condition
  4. Loop through an array

Correct Answer: 2. Jump to a specified label within the program

Explanation: The ‘goto’ statement in C is used to transfer control to a specified label within the program.


Quiz 91:

Which operator is used for bitwise left shift in C?

  1. << 
  2. >> 
  3. &
  4. |

Correct Answer: 1. <<

Explanation: The << operator is used for bitwise left shift in C, which shifts the bits to the left.


Quiz 92:

What is the role of the ‘include’ directive in C?

  1. Define a new function
  2. Include external files in the program
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Include external files in the program

Explanation: The ‘include’ directive in C is used to include external files in the program, often header files containing declarations.


Quiz 93:

Which of the following is the correct syntax for a function declaration in C?

  1. function MyFunction() { /* code */ }
  2. def MyFunction(): pass
  3. void MyFunction() { /* code */ }
  4. int MyFunction(int param);

Correct Answer: 4. int MyFunction(int param);

Explanation: The correct syntax for a function declaration in C includes the return type, function name, and parameter list.


Quiz 94:

What is the purpose of the ‘switch’ statement in C?

  1. Loop through a range of values
  2. Make decisions based on multiple conditions
  3. Create an infinite loop
  4. Define a constant value

Correct Answer: 2. Make decisions based on multiple conditions

Explanation: The ‘switch’ statement in C is used to make decisions based on the values of an expression.


Quiz 95:

Which of the following is the correct way to declare a pointer in C?

  1. int ptr;
  2. pointer int;
  3. int *ptr;
  4. ptr int;

Correct Answer: 3. int *ptr;

Explanation: The correct way to declare a pointer in C is by placing the asterisk (*) before the variable name.


Quiz 96:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 97:

Which function is used to convert a string to an integer in C?

  1. atoi()
  2. itoa()
  3. strtoi()
  4. intToStr()

Correct Answer: 1. atoi()

Explanation: The atoi() function in C is used to convert a string to an integer.


Quiz 98:

What is the purpose of the ‘const’ keyword in a function declaration in C?

  1. Specify the return type
  2. Declare a constant variable
  3. Define a constant value
  4. Indicate a variable parameter

Correct Answer: 4. Indicate a variable parameter

Explanation: The ‘const’ keyword in a function declaration is used to indicate that a parameter is a constant.


Quiz 99:

Which of the following is a valid way to initialize an array in C?

  1. int myArray = {1, 2, 3};
  2. int myArray[] = {1, 2, 3};
  3. myArray = {1, 2, 3};
  4. int myArray[3] = {1, 2, 3};

Correct Answer: 2. int myArray[] = {1, 2, 3};

Explanation: The correct syntax for initializing an array in C is to use curly braces {} with the values enclosed.


Quiz 100:

What is the purpose of the ‘volatile’ keyword in C?

  1. Declare a constant value
  2. Specify the return type of a function
  3. Indicate that a variable may be changed at any time
  4. Create a dynamic variable

Correct Answer: 3. Indicate that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 101:

Which function is used to write a character to the standard output in C?

  1. putchar()
  2. writechar()
  3. printchar()
  4. displaychar()

Correct Answer: 1. putchar()

Explanation: The putchar() function in C is used to write a character to the standard output (usually the console).


Quiz 102:

What is the purpose of the ‘rand()’ function in C?

  1. Allocate memory dynamically
  2. Generate a random number
  3. Return the square root of a number
  4. Convert a string to uppercase

Correct Answer: 2. Generate a random number

Explanation: The ‘rand()’ function in C is used to generate a pseudo-random integer.


Quiz 103:

In C, how can you declare a constant variable?

  1. const var = 5;
  2. constant int var = 5;
  3. var const = 5;
  4. int const var = 5;

Correct Answer: 4. int const var = 5;

Explanation: To declare a constant variable in C, use the ‘const’ keyword before the data type.


Quiz 104:

Which operator is used for pointer arithmetic in C?

  1. +
  2. *
  3. /

Correct Answer: 2. –

Explanation: The – operator is used for pointer arithmetic in C to find the difference between two pointers.


Quiz 105:

What is the purpose of the ‘do-while’ loop in C?

  1. Iterate over a range of values
  2. Make decisions based on a condition
  3. Execute a block of code at least once
  4. Create an infinite loop

Correct Answer: 3. Execute a block of code at least once

Explanation: The ‘do-while’ loop in C ensures that the code block is executed at least once, even if the condition is false.


Quiz 106:

Which header file should be included to use the ‘abs’ function in C for absolute value?

  1. stdlib.h
  2. math.h
  3. stdio.h
  4. limits.h

Correct Answer: 1. stdlib.h

Explanation: The ‘abs’ function for absolute value is part of the stdlib.h (standard library) in C.


Quiz 107:

What does the ‘static’ keyword do when applied to a variable in C?

  1. Allocates memory dynamically
  2. Declares a constant value
  3. Extends the variable’s scope to the entire program
  4. Specifies that the variable is not modifiable

Correct Answer: 3. Extends the variable’s scope to the entire program

Explanation: The ‘static’ keyword, when applied to a variable in C, extends its scope to the entire program.


Quiz 108:

Which of the following is a valid way to open a file in C for reading and writing?

  1. fopen(“file.txt”, “r”)
  2. fopen(“file.txt”, “w”)
  3. fopen(“file.txt”, “rw”)
  4. fopen(“file.txt”, “a+”)

Correct Answer: 4. fopen(“file.txt”, “a+”)

Explanation: The mode “a+” in fopen is used to open a file in C for reading and writing, with the file positioned at the end initially.


Quiz 109:

What is the purpose of the ‘continue’ statement in a loop in C?

  1. Skip the current iteration and move to the next
  2. Exit the loop
  3. Terminate the program
  4. Restart the loop from the beginning

Correct Answer: 1. Skip the current iteration and move to the next

Explanation: The ‘continue’ statement in C is used to skip the rest of the code inside a loop for the current iteration and move to the next one.


Quiz 110:

Which data type is used to store decimal numbers with single precision in C?

  1. float
  2. double
  3. long double
  4. decimal

Correct Answer: 1. float

Explanation: The float data type in C is used to store decimal numbers with single precision.


   Quiz 111:

Which header file should be included to use the ‘pow’ function in C for exponentiation?

  1. math.h
  2. stdio.h
  3. stdlib.h
  4. power.h

Correct Answer: 1. math.h

Explanation: The ‘pow’ function for exponentiation is part of the math.h (mathematics) library in C.


Quiz 112:

What is the purpose of the ‘getchar’ function in C?

  1. Read a character from the standard input
  2. Print a character to the standard output
  3. Return a character from a function
  4. Initialize a character variable

Correct Answer: 1. Read a character from the standard input

Explanation: The getchar function in C is used to read a single character from the standard input (usually the keyboard).


Quiz 113:

In C, what is the purpose of the ‘sizeof’ operator when used with a data type?

  1. Return the size of a variable
  2. Return the size of a constant
  3. Return the size of a pointer
  4. Return the size of the specified data type

Correct Answer: 4. Return the size of the specified data type

Explanation: The ‘sizeof’ operator in C, when used with a data type, returns the size, in bytes, of the specified data type.


Quiz 114:

Which operator is used for logical OR in C?

  1. &&
  2. ||
  3. !
  4. |

Correct Answer: 2. ||

Explanation: The || operator is used for logical OR in C.


Quiz 115:

What is the purpose of the ‘fwrite’ function in C?

  1. Read from a file
  2. Write to a file
  3. Copy one file to another
  4. Close a file

Correct Answer: 2. Write to a file

Explanation: The ‘fwrite’ function in C is used to write data to a file.


Quiz 116:

Which function is used to convert a character to its ASCII value in C?

  1. charToAscii()
  2. asciify()
  3. char()
  4. int()

Correct Answer: 4. int()

Explanation: To convert a character to its ASCII value in C, you can use an explicit type cast like int(character).


Quiz 117:

What is the purpose of the ‘strcat’ function in C?

  1. Compare two strings
  2. Copy one string to another
  3. Concatenate two strings
  4. Find the length of a string

Correct Answer: 3. Concatenate two strings

Explanation: The ‘strcat’ function in C is used to concatenate (append) two strings.


Quiz 118:

Which of the following is the correct syntax for declaring a structure in C?

  1. struct MyStruct { /* members */ };
  2. structure MyStruct { /* members */ };
  3. type MyStruct { /* members */ };
  4. new struct MyStruct { /* members */ };

Correct Answer: 1. struct MyStruct { /* members */ };

Explanation: The correct syntax for declaring a structure in C is struct MyStruct { /* members */ };.


Quiz 119:

What does the ‘volatile’ keyword do when applied to a variable in C?

  1. Declares a constant value
  2. Extends the variable’s scope to the entire program
  3. Specifies that the variable is not modifiable
  4. Indicates that a variable may be changed at any time

Correct Answer: 4. Indicates that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 120:

Which operator is used for pointer dereferencing in C?

  1. *
  2. &
  3. ->
  4. %

Correct Answer: 1. *

Explanation: The * operator is used for pointer dereferencing in C.


Quiz 121:

What is the purpose of the ‘const’ keyword in C when applied to a pointer?

  1. Indicates a constant value
  2. Specifies that the pointer cannot be modified
  3. Declares a constant pointer
  4. Specifies that the pointed-to value is constant

Correct Answer: 4. Specifies that the pointed-to value is constant

Explanation: When ‘const’ is applied to a pointer in C, it indicates that the pointed-to value is constant and cannot be modified through that pointer.


Quiz 122:

Which function is used to allocate memory for an array dynamically in C?

  1. malloc()
  2. calloc()
  3. realloc()
  4. alloc()

Correct Answer: 2. calloc()

Explanation: The calloc() function in C is used to dynamically allocate memory for an array and initializes the allocated memory to zero.


Quiz 123:

What is the purpose of the ‘strlen’ function in C?

  1. Concatenate two strings
  2. Compare two strings
  3. Find the length of a string
  4. Copy one string to another

Correct Answer: 3. Find the length of a string

Explanation: The ‘strlen’ function in C is used to determine the length (number of characters) of a string.


Quiz 124:

Which operator is used for bitwise AND in C?

  1. &
  2. |
  3. ^
  4. << 

Correct Answer: 1. &

Explanation: The & operator is used for bitwise AND in C.


Quiz 125:

What is the purpose of the ‘return’ statement in a function in C?

  1. Exit the program
  2. Return a value from the function
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Return a value from the function

Explanation: The ‘return’ statement in C is used to send a value back from a function.


Quiz 126:

Which function is used to close a file in C?

  1. fclose()
  2. close()
  3. fileclose()
  4. shutfile()

Correct Answer: 1. fclose()

Explanation: The fclose() function is used to close a file in C after performing file operations.


Quiz 127:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 128:

What is the purpose of the ‘typedef’ keyword in C?

  1. Declare a new type name
  2. Define a constant value
  3. Specify the return type of a function
  4. Create an alias for a variable

Correct Answer: 1. Declare a new type name

Explanation: The ‘typedef’ keyword in C is used to create a new type name for an existing data type.


Quiz 129:

Which of the following is the correct syntax for a function definition in C?

  1. def myFunction(): pass
  2. int myFunction() { /* code */ }
  3. void myFunction() { /* code */ }
  4. int myFunction(parameters) { /* code */ }

Correct Answer: 4. int myFunction(parameters) { /* code */ }

Explanation: The correct syntax for a function definition in C includes the return type, function name, parameters, and the function body.


Quiz 130:

What is the purpose of the ‘union’ keyword in C?

  1. Declare a new type name
  2. Represent a collection of variables
  3. Create an empty function
  4. Allocate memory dynamically

Correct Answer: 2. Represent a collection of variables

Explanation: The ‘union’ keyword in C is used to represent a collection of variables that share the same memory location.


Quiz 131:

Which header file should be included to use the ‘scanf’ function in C?

  1. input.h
  2. output.h
  3. stdio.h
  4. stdlib.h

Correct Answer: 3. stdio.h

Explanation: The ‘scanf’ function is part of the Standard Input/Output library in C, and the header file stdio.h should be included.


Quiz 132:

What is the purpose of the ‘for’ loop in C?

  1. Execute a block of code at least once
  2. Iterate over a range of values
  3. Make decisions based on a condition
  4. Skip the current iteration and move to the next

Correct Answer: 2. Iterate over a range of values

Explanation: The ‘for’ loop in C is used to iterate over a range of values with a specified control structure.


Quiz 133:

Which operator is used for the modulo operation in C?

  1. %
  2. &
  3. |
  4. ^

Correct Answer: 1. %

Explanation: The % operator is used for the modulo operation in C, which returns the remainder of a division.


Quiz 134:

What does the ‘sizeof’ operator return when used with a pointer in C?

  1. Size of the pointer variable
  2. Size of the data type to which the pointer points
  3. Total size of the memory allocated for the pointer
  4. Size of the memory address held by the pointer

Correct Answer: 1. Size of the pointer variable

Explanation: When used with a pointer, the ‘sizeof’ operator in C returns the size of the pointer variable.


Quiz 135:

Which function is used to open a file in C for writing?

  1. fopen(“filename”, “r”)
  2. fopen(“filename”, “w”)
  3. fopen(“filename”, “a”)
  4. fopen(“filename”, “rb”)

Correct Answer: 2. fopen(“filename”, “w”)

Explanation: The fopen function with mode “w” is used to open a file in C for writing.


Quiz 136:

In C, what is the purpose of the ‘else’ statement?

  1. Declare a variable
  2. Specify an alternative block of code
  3. Loop through an array
  4. Terminate the program

Correct Answer: 2. Specify an alternative block of code

Explanation: The ‘else’ statement in C is used to specify an alternative block of code to be executed when the ‘if’ condition is false.


Quiz 137:

Which data type is used to store whole numbers in C?

  1. int
  2. float
  3. char
  4. double

Correct Answer: 1. int

Explanation: The int data type is used to store whole numbers in C.


Quiz 138:

What is the purpose of the ‘free’ function in C?

  1. Allocate memory dynamically
  2. Initialize memory to zero
  3. Deallocate memory
  4. Allocate memory for an array of elements

Correct Answer: 3. Deallocate memory

Explanation: The ‘free’ function in C is used to deallocate memory that was previously allocated dynamically using functions like ‘malloc’ or ‘calloc’.


Quiz 139:

Which header file should be included to use the ‘strlen’ function in C?

  1. string.h
  2. stdio.h
  3. stdlib.h
  4. math.h

Correct Answer: 1. string.h

Explanation: The ‘strlen’ function is part of the string manipulation functions in C, and the header file string.h should be included.


Quiz 140:

What is the purpose of the ‘goto’ statement in C?

  1. Exit the program
  2. Jump to a specified label within the program
  3. Make decisions based on a condition
  4. Loop through an array

Correct Answer: 2. Jump to a specified label within the program

Explanation: The ‘goto’ statement in C is used to transfer control to a specified label within the program.


Quiz 141:

Which operator is used for bitwise left shift in C?

  1. << 
  2. >> 
  3. &
  4. |

Correct Answer: 1. <<

Explanation: The << operator is used for bitwise left shift in C, which shifts the bits to the left.


Quiz 142:

What is the role of the ‘include’ directive in C?

  1. Define a new function
  2. Include external files in the program
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Include external files in the program

Explanation: The ‘include’ directive in C is used to include external files in the program, often header files containing declarations.


Quiz 143:

Which of the following is the correct syntax for a function declaration in C?

  1. function MyFunction() { /* code */ }
  2. def MyFunction(): pass
  3. void MyFunction() { /* code */ }
  4. int MyFunction(int param);

Correct Answer: 4. int MyFunction(int param);

Explanation: The correct syntax for a function declaration in C includes the return type, function name, and parameter list.


Quiz 144:

What is the purpose of the ‘switch’ statement in C?

  1. Loop through a range of values
  2. Make decisions based on multiple conditions
  3. Create an infinite loop
  4. Define a constant value

Correct Answer: 2. Make decisions based on multiple conditions

Explanation: The ‘switch’ statement in C is used to make decisions based on the values of an expression.


Quiz 145:

Which of the following is the correct way to declare a pointer in C?

  1. int ptr;
  2. pointer int;
  3. int *ptr;
  4. ptr int;

Correct Answer: 3. int *ptr;

Explanation: The correct way to declare a pointer in C is by placing the asterisk (*) before the variable name.


Quiz 146:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 147:

Which function is used to convert a string to an integer in C?

  1. atoi()
  2. itoa()
  3. strtoi()
  4. intToStr()

Correct Answer: 1. atoi()

Explanation: The atoi() function in C is used to convert a string to an integer.


Quiz 148:

What is the purpose of the ‘const’ keyword in a function declaration in C?

  1. Specify the return type
  2. Declare a constant variable
  3. Define a constant value
  4. Indicate a variable parameter

Correct Answer: 4. Indicate a variable parameter

Explanation: The ‘const’ keyword in a function declaration is used to indicate that a parameter is a constant.


Quiz 149:

Which of the following is a valid way to initialize an array in C?

  1. int myArray = {1, 2, 3};
  2. int myArray[] = {1, 2, 3};
  3. myArray = {1, 2, 3};
  4. int myArray[3] = {1, 2, 3};

Correct Answer: 2. int myArray[] = {1, 2, 3};

Explanation: The correct syntax for initializing an array in C is to use curly braces {} with the values enclosed.


Quiz 150:

What is the purpose of the ‘volatile’ keyword in C?

  1. Declare a constant value
  2. Specify the return type of a function
  3. Indicate that a variable may be changed at any time
  4. Create a dynamic variable

Correct Answer: 3. Indicate that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 151:

Which function is used to write a character to the standard output in C?

  1. putchar()
  2. writechar()
  3. printchar()
  4. displaychar()

Correct Answer: 1. putchar()

Explanation: The putchar() function in C is used to write a character to the standard output (usually the console).


Quiz 152:

What is the purpose of the ‘rand()’ function in C?

  1. Allocate memory dynamically
  2. Generate a random number
  3. Return the square root of a number
  4. Convert a string to uppercase

Correct Answer: 2. Generate a random number

Explanation: The ‘rand()’ function in C is used to generate a pseudo-random integer.


Quiz 153:

In C, how can you declare a constant variable?

  1. const var = 5;
  2. constant int var = 5;
  3. var const = 5;
  4. int const var = 5;

Correct Answer: 4. int const var = 5;

Explanation: To declare a constant variable in C, use the ‘const’ keyword before the data type.


Quiz 154:

Which operator is used for pointer arithmetic in C?

  1. +
  2. *
  3. /

Correct Answer: 2. –

Explanation: The – operator is used for pointer arithmetic in C to find the difference between two pointers.


Quiz 155:

What is the purpose of the ‘do-while’ loop in C?

  1. Iterate over a range of values
  2. Make decisions based on a condition
  3. Execute a block of code at least once
  4. Create an infinite loop

Correct Answer: 3. Execute a block of code at least once

Explanation: The ‘do-while’ loop in C ensures that the code block is executed at least once, even if the condition is false.


Quiz 156:

Which header file should be included to use the ‘abs’ function in C for absolute value?

  1. stdlib.h
  2. math.h
  3. stdio.h
  4. limits.h

Correct Answer: 1. stdlib.h

Explanation: The ‘abs’ function for absolute value is part of the stdlib.h (standard library) in C.


Quiz 157:

What does the ‘static’ keyword do when applied to a variable in C?

  1. Allocates memory dynamically
  2. Declares a constant value
  3. Extends the variable’s scope to the entire program
  4. Specifies that the variable is not modifiable

Correct Answer: 3. Extends the variable’s scope to the entire program

Explanation: The ‘static’ keyword, when applied to a variable in C, extends its scope to the entire program.


Quiz 158:

Which of the following is a valid way to open a file in C for reading and writing?

  1. fopen(“file.txt”, “r”)
  2. fopen(“file.txt”, “w”)
  3. fopen(“file.txt”, “rw”)
  4. fopen(“file.txt”, “a+”)

Correct Answer: 4. fopen(“file.txt”, “a+”)

Explanation: The mode “a+” in fopen is used to open a file in C for reading and writing, with the file positioned at the end initially.


Quiz 159:

What is the purpose of the ‘continue’ statement in a loop in C?

  1. Skip the current iteration and move to the next
  2. Exit the loop
  3. Terminate the program
  4. Restart the loop from the beginning

Correct Answer: 1. Skip the current iteration and move to the next

Explanation: The ‘continue’ statement in C is used to skip the rest of the code inside a loop for the current iteration and move to the next one.


Quiz 160:

Which data type is used to store decimal numbers with single precision in C?

  1. float
  2. double
  3. long double
  4. decimal

Correct Answer: 1. float

Explanation: The float data type in C is used to store decimal numbers with single precision.


Quiz 161:

Which header file should be included to use the ‘pow’ function in C for exponentiation?

  1. math.h
  2. stdio.h
  3. stdlib.h
  4. power.h

Correct Answer: 1. math.h

Explanation: The ‘pow’ function for exponentiation is part of the math.h (mathematics) library in C.


Quiz 162:

What is the purpose of the ‘getchar’ function in C?

  1. Read a character from the standard input
  2. Print a character to the standard output
  3. Return a character from a function
  4. Initialize a character variable

Correct Answer: 1. Read a character from the standard input

Explanation: The getchar function in C is used to read a single character from the standard input (usually the keyboard).


Quiz 163:

In C, what is the purpose of the ‘sizeof’ operator when used with a data type?

  1. Return the size of a variable
  2. Return the size of a constant
  3. Return the size of a pointer
  4. Return the size of the specified data type

Correct Answer: 4. Return the size of the specified data type

Explanation: The ‘sizeof’ operator in C, when used with a data type, returns the size, in bytes, of the specified data type.


Quiz 164:

Which operator is used for logical OR in C?

  1. &&
  2. ||
  3. !
  4. |

Correct Answer: 2. ||

Explanation: The || operator is used for logical OR in C.


Quiz 165:

What is the purpose of the ‘fwrite’ function in C?

  1. Read from a file
  2. Write to a file
  3. Copy one file to another
  4. Close a file

Correct Answer: 2. Write to a file

Explanation: The ‘fwrite’ function in C is used to write data to a file.


Quiz 166:

Which function is used to convert a character to its ASCII value in C?

  1. charToAscii()
  2. asciify()
  3. char()
  4. int()

Correct Answer: 4. int()

Explanation: To convert a character to its ASCII value in C, you can use an explicit type cast like int(character).


Quiz 167:

What is the purpose of the ‘strcat’ function in C?

  1. Compare two strings
  2. Copy one string to another
  3. Concatenate two strings
  4. Find the length of a string

Correct Answer: 3. Concatenate two strings

Explanation: The ‘strcat’ function in C is used to concatenate (append) two strings.


Quiz 168:

Which of the following is the correct syntax for declaring a structure in C?

  1. struct MyStruct { /* members */ };
  2. structure MyStruct { /* members */ };
  3. type MyStruct { /* members */ };
  4. new struct MyStruct { /* members */ };

Correct Answer: 1. struct MyStruct { /* members */ };

Explanation: The correct syntax for declaring a structure in C is struct MyStruct { /* members */ };.


Quiz 169:

What does the ‘volatile’ keyword do when applied to a variable in C?

  1. Declares a constant value
  2. Extends the variable’s scope to the entire program
  3. Specifies that the variable is not modifiable
  4. Indicates that a variable may be changed at any time

Correct Answer: 4. Indicates that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 170:

Which operator is used for pointer dereferencing in C?

  1. *
  2. &
  3. ->
  4. %

Correct Answer: 1. *

Explanation: The * operator is used for pointer dereferencing in C.


Quiz 171:

What is the purpose of the ‘const’ keyword in C when applied to a pointer?

  1. Indicates a constant value
  2. Specifies that the pointer cannot be modified
  3. Declares a constant pointer
  4. Specifies that the pointed-to value is constant

Correct Answer: 4. Specifies that the pointed-to value is constant

Explanation: When ‘const’ is applied to a pointer in C, it indicates that the pointed-to value is constant and cannot be modified through that pointer.


Quiz 172:

Which function is used to allocate memory for an array dynamically in C?

  1. malloc()
  2. calloc()
  3. realloc()
  4. alloc()

Correct Answer: 2. calloc()

Explanation: The calloc() function in C is used to dynamically allocate memory for an array and initializes the allocated memory to zero.


Quiz 173:

What is the purpose of the ‘strlen’ function in C?

  1. Concatenate two strings
  2. Compare two strings
  3. Find the length of a string
  4. Copy one string to another

Correct Answer: 3. Find the length of a string

Explanation: The ‘strlen’ function in C is used to determine the length (number of characters) of a string.


Quiz 174:

Which operator is used for bitwise AND in C?

  1. &
  2. |
  3. ^
  4. << 

Correct Answer: 1. &

Explanation: The & operator is used for bitwise AND in C.


Quiz 175:

What is the purpose of the ‘return’ statement in a function in C?

  1. Exit the program
  2. Return a value from the function
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Return a value from the function

Explanation: The ‘return’ statement in C is used to send a value back from a function.


Quiz 176:

Which function is used to close a file in C?

  1. fclose()
  2. close()
  3. fileclose()
  4. shutfile()

Correct Answer: 1. fclose()

Explanation: The fclose() function is used to close a file in C after performing file operations.


Quiz 177:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 178:

What is the purpose of the ‘typedef’ keyword in C?

  1. Declare a new type name
  2. Define a constant value
  3. Specify the return type of a function
  4. Create an alias for a variable

Correct Answer: 1. Declare a new type name

Explanation: The ‘typedef’ keyword in C is used to create a new type name for an existing data type.


Quiz 179:

Which of the following is the correct syntax for declaring a function in C?

  1. def myFunction(): pass
  2. int myFunction() { /* code */ }
  3. void myFunction() { /* code */ }
  4. int myFunction(parameters) { /* code */ }

Correct Answer: 4. int myFunction(parameters) { /* code */ }

Explanation: The correct syntax for a function declaration in C includes the return type, function name, parameters, and the function body.


Quiz 180:

What is the purpose of the ‘union’ keyword in C?

  1. Declare a new type name
  2. Represent a collection of variables
  3. Create an empty function
  4. Allocate memory dynamically

Correct Answer: 2. Represent a collection of variables

Explanation: The ‘union’ keyword in C is used to represent a collection of variables that share the same memory location.


Quiz 181:

Which header file should be included to use the ‘scanf’ function in C?

  1. input.h
  2. output.h
  3. stdio.h
  4. stdlib.h

Correct Answer: 3. stdio.h

Explanation: The ‘scanf’ function is part of the Standard Input/Output library in C, and the header file stdio.h should be included.


Quiz 182:

What is the purpose of the ‘for’ loop in C?

  1. Execute a block of code at least once
  2. Iterate over a range of values
  3. Make decisions based on a condition
  4. Skip the current iteration and move to the next

Correct Answer: 2. Iterate over a range of values

Explanation: The ‘for’ loop in C is used to iterate over a range of values with a specified control structure.


Quiz 183:

Which operator is used for the modulo operation in C?

  1. %
  2. &
  3. |
  4. ^

Correct Answer: 1. %

Explanation: The % operator is used for the modulo operation in C, which returns the remainder of a division.


Quiz 184:

What does the ‘sizeof’ operator return when used with a pointer in C?

  1. Size of the pointer variable
  2. Size of the data type to which the pointer points
  3. Total size of the memory allocated for the pointer
  4. Size of the memory address held by the pointer

Correct Answer: 1. Size of the pointer variable

Explanation: When used with a pointer, the ‘sizeof’ operator in C returns the size of the pointer variable.


Quiz 185:

Which function is used to open a file in C for writing?

  1. fopen(“filename”, “r”)
  2. fopen(“filename”, “w”)
  3. fopen(“filename”, “a”)
  4. fopen(“filename”, “rb”)

Correct Answer: 2. fopen(“filename”, “w”)

Explanation: The fopen function with mode “w” is used to open a file in C for writing.


Quiz 186:

In C, what is the purpose of the ‘else’ statement?

  1. Declare a variable
  2. Specify an alternative block of code
  3. Loop through an array
  4. Terminate the program

Correct Answer: 2. Specify an alternative block of code

Explanation: The ‘else’ statement in C is used to specify an alternative block of code to be executed when the ‘if’ condition is false.


Quiz 187:

Which data type is used to store whole numbers in C?

  1. int
  2. float
  3. char
  4. double

Correct Answer: 1. int

Explanation: The int data type is used to store whole numbers in C.


Quiz 188:

What is the purpose of the ‘free’ function in C?

  1. Allocate memory dynamically
  2. Initialize memory to zero
  3. Deallocate memory
  4. Allocate memory for an array of elements

Correct Answer: 3. Deallocate memory

Explanation: The ‘free’ function in C is used to deallocate memory that was previously allocated dynamically using functions like ‘malloc’ or ‘calloc’.


Quiz 189:

Which header file should be included to use the ‘strlen’ function in C?

  1. string.h
  2. stdio.h
  3. stdlib.h
  4. math.h

Correct Answer: 1. string.h

Explanation: The ‘strlen’ function is part of the string manipulation functions in C, and the header file string.h should be included.


Quiz 190:

What is the purpose of the ‘goto’ statement in C?

  1. Exit the program
  2. Jump to a specified label within the program
  3. Make decisions based on a condition
  4. Loop through an array

Correct Answer: 2. Jump to a specified label within the program

Explanation: The ‘goto’ statement in C is used to transfer control to a specified label within the program.


Quiz 191:

Which operator is used for bitwise left shift in C?

  1. << 
  2. >> 
  3. &
  4. |

Correct Answer: 1. <<

Explanation: The << operator is used for bitwise left shift in C, which shifts the bits to the left.


Quiz 192:

What is the role of the ‘include’ directive in C?

  1. Define a new function
  2. Include external files in the program
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Include external files in the program

Explanation: The ‘include’ directive in C is used to include external files in the program, often header files containing declarations.


Quiz 193:

Which of the following is the correct syntax for a function declaration in C?

  1. function MyFunction() { /* code */ }
  2. def MyFunction(): pass
  3. void MyFunction() { /* code */ }
  4. int MyFunction(int param);

Correct Answer: 4. int MyFunction(int param);

Explanation: The correct syntax for a function declaration in C includes the return type, function name, and parameter list.


Quiz 194:

What is the purpose of the ‘switch’ statement in C?

  1. Loop through a range of values
  2. Make decisions based on multiple conditions
  3. Create an infinite loop
  4. Define a constant value

Correct Answer: 2. Make decisions based on multiple conditions

Explanation: The ‘switch’ statement in C is used to make decisions based on the values of an expression.

Quiz 195:

Which of the following is the correct way to declare a pointer in C?

  1. int ptr;
  2. pointer int;
  3. int *ptr;
  4. ptr int;

Correct Answer: 3. int *ptr;

Explanation: The correct way to declare a pointer in C is by placing the asterisk (*) before the variable name.


Quiz 196:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 197:

Which function is used to convert a string to an integer in C?

  1. atoi()
  2. itoa()
  3. strtoi()
  4. intToStr()

Correct Answer: 1. atoi()

Explanation: The atoi() function in C is used to convert a string to an integer.


Quiz 198:

What is the purpose of the ‘const’ keyword in a function declaration in C?

  1. Specify the return type
  2. Declare a constant variable
  3. Define a constant value
  4. Indicate a variable parameter

Correct Answer: 4. Indicate a variable parameter

Explanation: The ‘const’ keyword in a function declaration is used to indicate that a parameter is a constant.


Quiz 199:

Which of the following is a valid way to initialize an array in C?

  1. int myArray = {1, 2, 3};
  2. int myArray[] = {1, 2, 3};
  3. myArray = {1, 2, 3};
  4. int myArray[3] = {1, 2, 3};

Correct Answer: 2. int myArray[] = {1, 2, 3};

Explanation: The correct syntax for initializing an array in C is to use curly braces {} with the values enclosed.


Quiz 200:

What is the purpose of the ‘volatile’ keyword in C?

  1. Declare a constant value
  2. Specify the return type of a function
  3. Indicate that a variable may be changed at any time
  4. Create a dynamic variable

Correct Answer: 3. Indicate that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 201:

Which function is used to write a character to the standard output in C?

  1. putchar()
  2. writechar()
  3. printchar()
  4. displaychar()

Correct Answer: 1. putchar()

Explanation: The putchar() function in C is used to write a character to the standard output (usually the console).


Quiz 202:

What is the purpose of the ‘rand()’ function in C?

  1. Allocate memory dynamically
  2. Generate a random number
  3. Return the square root of a number
  4. Convert a string to uppercase

Correct Answer: 2. Generate a random number

Explanation: The ‘rand()’ function in C is used to generate a pseudo-random integer.


Quiz 203:

In C, how can you declare a constant variable?

  1. const var = 5;
  2. constant int var = 5;
  3. var const = 5;
  4. int const var = 5;

Correct Answer: 4. int const var = 5;

Explanation: To declare a constant variable in C, use the ‘const’ keyword before the data type.


Quiz 204:

Which operator is used for pointer arithmetic in C?

  1. +
  2. *
  3. /

Correct Answer: 2. –

Explanation: The – operator is used for pointer arithmetic in C to find the difference between two pointers.


Quiz 205:

What is the purpose of the ‘do-while’ loop in C?

  1. Iterate over a range of values
  2. Make decisions based on a condition
  3. Execute a block of code at least once
  4. Create an infinite loop

Correct Answer: 3. Execute a block of code at least once

Explanation: The ‘do-while’ loop in C ensures that the code block is executed at least once, even if the condition is false.


Quiz 206:

Which header file should be included to use the ‘abs’ function in C for absolute value?

  1. stdlib.h
  2. math.h
  3. stdio.h
  4. limits.h

Correct Answer: 1. stdlib.h

Explanation: The ‘abs’ function for absolute value is part of the stdlib.h (standard library) in C.


Quiz 207:

What does the ‘static’ keyword do when applied to a variable in C?

  1. Allocates memory dynamically
  2. Declares a constant value
  3. Extends the variable’s scope to the entire program
  4. Specifies that the variable is not modifiable

Correct Answer: 3. Extends the variable’s scope to the entire program

Explanation: The ‘static’ keyword, when applied to a variable in C, extends its scope to the entire program.


Quiz 208:

Which of the following is a valid way to open a file in C for reading and writing?

  1. fopen(“file.txt”, “r”)
  2. fopen(“file.txt”, “w”)
  3. fopen(“file.txt”, “rw”)
  4. fopen(“file.txt”, “a+”)

Correct Answer: 4. fopen(“file.txt”, “a+”)

Explanation: The mode “a+” in fopen is used to open a file in C for reading and writing, with the file positioned at the end initially.


Quiz 209:

What is the purpose of the ‘continue’ statement in a loop in C?

  1. Skip the current iteration and move to the next
  2. Exit the loop
  3. Terminate the program
  4. Restart the loop from the beginning

Correct Answer: 1. Skip the current iteration and move to the next

Explanation: The ‘continue’ statement in C is used to skip the rest of the code inside a loop for the current iteration and move to the next one.


Quiz 210:

Which data type is used to store decimal numbers with single precision in C?

  1. float
  2. double
  3. long double
  4. decimal

Correct Answer: 1. float

Explanation: The float data type in C is used to store decimal numbers with single precision.


Quiz 211:

Which header file should be included to use the ‘pow’ function in C for exponentiation?

  1. math.h
  2. stdio.h
  3. stdlib.h
  4. power.h

Correct Answer: 1. math.h

Explanation: The ‘pow’ function for exponentiation is part of the math.h (mathematics) library in C.


Quiz 212:

What is the purpose of the ‘getchar’ function in C?

  1. Read a character from the standard input
  2. Print a character to the standard output
  3. Return a character from a function
  4. Initialize a character variable

Correct Answer: 1. Read a character from the standard input

Explanation: The getchar function in C is used to read a single character from the standard input (usually the keyboard).


Quiz 213:

In C, what is the purpose of the ‘sizeof’ operator when used with a data type?

  1. Return the size of a variable
  2. Return the size of a constant
  3. Return the size of a pointer
  4. Return the size of the specified data type

Correct Answer: 4. Return the size of the specified data type

Explanation: The ‘sizeof’ operator in C, when used with a data type, returns the size, in bytes, of the specified data type.


Quiz 214:

Which operator is used for logical OR in C?

  1. &&
  2. ||
  3. !
  4. |

Correct Answer: 2. ||

Explanation: The || operator is used for logical OR in C.


Quiz 215:

What is the purpose of the ‘fwrite’ function in C?

  1. Read from a file
  2. Write to a file
  3. Copy one file to another
  4. Close a file

Correct Answer: 2. Write to a file

Explanation: The ‘fwrite’ function in C is used to write data to a file.


Quiz 216:

Which function is used to convert a character to its ASCII value in C?

  1. charToAscii()
  2. asciify()
  3. char()
  4. int()

Correct Answer: 4. int()

Explanation: To convert a character to its ASCII value in C, you can use an explicit type cast like int(character).


Quiz 217:

What is the purpose of the ‘strcat’ function in C?

  1. Compare two strings
  2. Copy one string to another
  3. Concatenate two strings
  4. Find the length of a string

Correct Answer: 3. Concatenate two strings

Explanation: The ‘strcat’ function in C is used to concatenate (append) two strings.


Quiz 218:

Which of the following is the correct syntax for declaring a structure in C?

  1. struct MyStruct { /* members */ };
  2. structure MyStruct { /* members */ };
  3. type MyStruct { /* members */ };
  4. new struct MyStruct { /* members */ };

Correct Answer: 1. struct MyStruct { /* members */ };

Explanation: The correct syntax for declaring a structure in C is struct MyStruct { /* members */ };.


Quiz 219:

What does the ‘volatile’ keyword do when applied to a variable in C?

  1. Declares a constant value
  2. Extends the variable’s scope to the entire program
  3. Specifies that the variable is not modifiable
  4. Indicates that a variable may be changed at any time

Correct Answer: 4. Indicates that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 220:

Which operator is used for pointer dereferencing in C?

  1. *
  2. &
  3. ->
  4. %

Correct Answer: 1. *

Explanation: The * operator is used for pointer dereferencing in C.


Quiz 221:

What is the purpose of the ‘const’ keyword in C when applied to a pointer?

  1. Indicates a constant value
  2. Specifies that the pointer cannot be modified
  3. Declares a constant pointer
  4. Specifies that the pointed-to value is constant

Correct Answer: 4. Specifies that the pointed-to value is constant

Explanation: When ‘const’ is applied to a pointer in C, it indicates that the pointed-to value is constant and cannot be modified through that pointer.


Quiz 222:

Which function is used to allocate memory for an array dynamically in C?

  1. malloc()
  2. calloc()
  3. realloc()
  4. alloc()

Correct Answer: 2. calloc()

Explanation: The calloc() function in C is used to dynamically allocate memory for an array and initializes the allocated memory to zero.


Quiz 223:

What is the purpose of the ‘strlen’ function in C?

  1. Concatenate two strings
  2. Compare two strings
  3. Find the length of a string
  4. Copy one string to another

Correct Answer: 3. Find the length of a string

Explanation: The ‘strlen’ function in C is used to determine the length (number of characters) of a string.


Quiz 224:

Which operator is used for bitwise AND in C?

  1. &
  2. |
  3. ^
  4. << 

Correct Answer: 1. &

Explanation: The & operator is used for bitwise AND in C.


Quiz 225:

What is the purpose of the ‘return’ statement in a function in C?

  1. Exit the program
  2. Return a value from the function
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Return a value from the function

Explanation: The ‘return’ statement in C is used to send a value back from a function.


Quiz 226:

Which function is used to close a file in C?

  1. fclose()
  2. close()
  3. fileclose()
  4. shutfile()

Correct Answer: 1. fclose()

Explanation: The fclose() function is used to close a file in C after performing file operations.


Quiz 227:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 228:

What is the purpose of the ‘typedef’ keyword in C?

  1. Declare a new type name
  2. Define a constant value
  3. Specify the return type of a function
  4. Create an alias for a variable

Correct Answer: 1. Declare a new type name

Explanation: The ‘typedef’ keyword in C is used to create a new type name for an existing data type.


Quiz 229:

Which of the following is the correct syntax for declaring a function in C?

  1. def myFunction(): pass
  2. int myFunction() { /* code */ }
  3. void myFunction() { /* code */ }
  4. int myFunction(parameters) { /* code */ }

Correct Answer: 4. int myFunction(parameters) { /* code */ }

Explanation: The correct syntax for a function declaration in C includes the return type, function name, parameters, and the function body.


Quiz 230:

What is the purpose of the ‘union’ keyword in C?

  1. Declare a new type name
  2. Represent a collection of variables
  3. Create an empty function
  4. Allocate memory dynamically

Correct Answer: 2. Represent a collection of variables

Explanation: The ‘union’ keyword in C is used to represent a collection of variables that share the same memory location.


Quiz 231:

Which header file should be included to use the ‘scanf’ function in C?

  1. input.h
  2. output.h
  3. stdio.h
  4. stdlib.h

Correct Answer: 3. stdio.h

Explanation: The ‘scanf’ function is part of the Standard Input/Output library in C, and the header file stdio.h should be included.


Quiz 232:

What is the purpose of the ‘for’ loop in C?

  1. Execute a block of code at least once
  2. Iterate over a range of values
  3. Make decisions based on a condition
  4. Skip the current iteration and move to the next

Correct Answer: 2. Iterate over a range of values

Explanation: The ‘for’ loop in C is used to iterate over a range of values with a specified control structure.


Quiz 233:

Which operator is used for the modulo operation in C?

  1. %
  2. &
  3. |
  4. ^

Correct Answer: 1. %

Explanation: The % operator is used for the modulo operation in C, which returns the remainder of a division.


Quiz 234:

What does the ‘sizeof’ operator return when used with a pointer in C?

  1. Size of the pointer variable
  2. Size of the data type to which the pointer points
  3. Total size of the memory allocated for the pointer
  4. Size of the memory address held by the pointer

Correct Answer: 1. Size of the pointer variable

Explanation: When used with a pointer, the ‘sizeof’ operator in C returns the size of the pointer variable.


Quiz 235:

Which function is used to open a file in C for writing?

  1. fopen(“filename”, “r”)
  2. fopen(“filename”, “w”)
  3. fopen(“filename”, “a”)
  4. fopen(“filename”, “rb”)

Correct Answer: 2. fopen(“filename”, “w”)

Explanation: The fopen function with mode “w” is used to open a file in C for writing.


Quiz 236:

In C, what is the purpose of the ‘else’ statement?

  1. Declare a variable
  2. Specify an alternative block of code
  3. Loop through an array
  4. Terminate the program

Correct Answer: 2. Specify an alternative block of code

Explanation: The ‘else’ statement in C is used to specify an alternative block of code to be executed when the ‘if’ condition is false.


Quiz 237:

Which data type is used to store whole numbers in C?

  1. int
  2. float
  3. char
  4. double

Correct Answer: 1. int

Explanation: The int data type is used to store whole numbers in C.


Quiz 238:

What is the purpose of the ‘free’ function in C?

  1. Allocate memory dynamically
  2. Initialize memory to zero
  3. Deallocate memory
  4. Allocate memory for an array of elements

Correct Answer: 3. Deallocate memory

Explanation: The ‘free’ function in C is used to deallocate memory that was previously allocated dynamically using functions like ‘malloc’ or ‘calloc’.


Quiz 239:

Which header file should be included to use the ‘strlen’ function in C?

  1. string.h
  2. stdio.h
  3. stdlib.h
  4. math.h

Correct Answer: 1. string.h

Explanation: The ‘strlen’ function is part of the string manipulation functions in C, and the header file string.h should be included.


Quiz 240:

What is the purpose of the ‘goto’ statement in C?

  1. Exit the program
  2. Jump to a specified label within the program
  3. Make decisions based on a condition
  4. Loop through an array

Correct Answer: 2. Jump to a specified label within the program

Explanation: The ‘goto’ statement in C is used to transfer control to a specified label within the program.


Quiz 241:

Which operator is used for bitwise left shift in C?

  1. << 
  2. >> 
  3. &
  4. |

Correct Answer: 1. <<

Explanation: The << operator is used for bitwise left shift in C, which shifts the bits to the left.


Quiz 242:

What is the role of the ‘include’ directive in C?

  1. Define a new function
  2. Include external files in the program
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Include external files in the program

Explanation: The ‘include’ directive in C is used to include external files in the program, often header files containing declarations.


Quiz 243:

Which of the following is the correct syntax for a function declaration in C?

  1. function MyFunction() { /* code */ }
  2. def MyFunction(): pass
  3. void MyFunction() { /* code */ }
  4. int MyFunction(int param);

Correct Answer: 4. int MyFunction(int param);

Explanation: The correct syntax for a function declaration in C includes the return type, function name, and parameter list.


Quiz 244:

What is the purpose of the ‘switch’ statement in C?

  1. Loop through a range of values
  2. Make decisions based on multiple conditions
  3. Create an infinite loop
  4. Define a constant value

Correct Answer: 2. Make decisions based on multiple conditions

Explanation: The ‘switch’ statement in C is used to make decisions based on the values of an expression.


Quiz 245:

Which of the following is the correct way to declare a pointer in C?

  1. int ptr;
  2. pointer int;
  3. int *ptr;
  4. ptr int;

Correct Answer: 3. int *ptr;

Explanation: The correct way to declare a pointer in C is by placing the asterisk (*) before the variable name.


Quiz 246:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 247:

Which function is used to convert a string to an integer in C?

  1. atoi()
  2. itoa()
  3. strtoi()
  4. intToStr()

Correct Answer: 1. atoi()

Explanation: The atoi() function in C is used to convert a string to an integer.


Quiz 248:

What is the purpose of the ‘const’ keyword in a function declaration in C?

  1. Specify the return type
  2. Declare a constant variable
  3. Define a constant value
  4. Indicate a variable parameter

Correct Answer: 4. Indicate a variable parameter

Explanation: The ‘const’ keyword in a function declaration is used to indicate that a parameter is a constant.


Quiz 249:

Which of the following is a valid way to initialize an array in C?

  1. int myArray = {1, 2, 3};
  2. int myArray[] = {1, 2, 3};
  3. myArray = {1, 2, 3};
  4. int myArray[3] = {1, 2, 3};

Correct Answer: 2. int myArray[] = {1, 2, 3};

Explanation: The correct syntax for initializing an array in C is to use curly braces {} with the values enclosed.


Quiz 250:

What is the purpose of the ‘volatile’ keyword in C?

  1. Declare a constant value
  2. Specify the return type of a function
  3. Indicate that a variable may be changed at any time
  4. Create a dynamic variable

Correct Answer: 3. Indicate that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 251:

Which function is used to write a character to the standard output in C?

  1. putchar()
  2. writechar()
  3. printchar()
  4. displaychar()

Correct Answer: 1. putchar()

Explanation: The putchar() function in C is used to write a character to the standard output (usually the console).


Quiz 252:

What is the purpose of the ‘rand()’ function in C?

  1. Allocate memory dynamically
  2. Generate a random number
  3. Return the square root of a number
  4. Convert a string to uppercase

Correct Answer: 2. Generate a random number

Explanation: The ‘rand()’ function in C is used to generate a pseudo-random integer.


Quiz 253:

In C, how can you declare a constant variable?

  1. const var = 5;
  2. constant int var = 5;
  3. var const = 5;
  4. int const var = 5;

Correct Answer: 4. int const var = 5;

Explanation: To declare a constant variable in C, use the ‘const’ keyword before the data type.


Quiz 254:

Which operator is used for pointer arithmetic in C?

  1. +
  2. *
  3. /

Correct Answer: 2. –

Explanation: The – operator is used for pointer arithmetic in C to find the difference between two pointers.


Quiz 255:

What is the purpose of the ‘do-while’ loop in C?

  1. Iterate over a range of values
  2. Make decisions based on a condition
  3. Execute a block of code at least once
  4. Create an infinite loop

Correct Answer: 3. Execute a block of code at least once

Explanation: The ‘do-while’ loop in C ensures that the code block is executed at least once, even if the condition is false.


Quiz 256:

Which header file should be included to use the ‘abs’ function in C for absolute value?

  1. stdlib.h
  2. math.h
  3. stdio.h
  4. limits.h

Correct Answer: 1. stdlib.h

Explanation: The ‘abs’ function for absolute value is part of the stdlib.h (standard library) in C.


Quiz 257:

What does the ‘static’ keyword do when applied to a variable in C?

  1. Allocates memory dynamically
  2. Declares a constant value
  3. Extends the variable’s scope to the entire program
  4. Specifies that the variable is not modifiable

Correct Answer: 3. Extends the variable’s scope to the entire program

Explanation: The ‘static’ keyword, when applied to a variable in C, extends its scope to the entire program.


Quiz 258:

Which of the following is a valid way to open a file in C for reading and writing?

  1. fopen(“file.txt”, “r”)
  2. fopen(“file.txt”, “w”)
  3. fopen(“file.txt”, “rw”)
  4. fopen(“file.txt”, “a+”)

Correct Answer: 4. fopen(“file.txt”, “a+”)

Explanation: The mode “a+” in fopen is used to open a file in C for reading and writing, with the file positioned at the end initially.


Quiz 259:

What is the purpose of the ‘continue’ statement in a loop in C?

  1. Skip the current iteration and move to the next
  2. Exit the loop
  3. Terminate the program
  4. Restart the loop from the beginning

Correct Answer: 1. Skip the current iteration and move to the next

Explanation: The ‘continue’ statement in C is used to skip the rest of the code inside a loop for the current iteration and move to the next one.


Quiz 260:

Which data type is used to store decimal numbers with single precision in C?

  1. float
  2. double
  3. long double
  4. decimal

Correct Answer: 1. float

Explanation: The float data type in C is used to store decimal numbers with single precision.


Quiz 261:

Which header file should be included to use the ‘pow’ function in C for exponentiation?

  1. math.h
  2. stdio.h
  3. stdlib.h
  4. power.h

Correct Answer: 1. math.h

Explanation: The ‘pow’ function for exponentiation is part of the math.h (mathematics) library in C.


Quiz 262:

What is the purpose of the ‘getchar’ function in C?

  1. Read a character from the standard input
  2. Print a character to the standard output
  3. Return a character from a function
  4. Initialize a character variable

Correct Answer: 1. Read a character from the standard input

Explanation: The getchar function in C is used to read a single character from the standard input (usually the keyboard).


Quiz 263:

In C, what is the purpose of the ‘sizeof’ operator when used with a data type?

  1. Return the size of a variable
  2. Return the size of a constant
  3. Return the size of a pointer
  4. Return the size of the specified data type

Correct Answer: 4. Return the size of the specified data type

Explanation: The ‘sizeof’ operator in C, when used with a data type, returns the size, in bytes, of the specified data type.


Quiz 264:

Which operator is used for logical OR in C?

  1. &&
  2. ||
  3. !
  4. |

Correct Answer: 2. ||

Explanation: The || operator is used for logical OR in C.


Quiz 265:

What is the purpose of the ‘fwrite’ function in C?

  1. Read from a file
  2. Write to a file
  3. Copy one file to another
  4. Close a file

Correct Answer: 2. Write to a file

Explanation: The ‘fwrite’ function in C is used to write data to a file.


Quiz 266:

Which function is used to convert a character to its ASCII value in C?

  1. charToAscii()
  2. asciify()
  3. char()
  4. int()

Correct Answer: 4. int()

Explanation: To convert a character to its ASCII value in C, you can use an explicit type cast like int(character).


Quiz 267:

What is the purpose of the ‘strcat’ function in C?

  1. Compare two strings
  2. Copy one string to another
  3. Concatenate two strings
  4. Find the length of a string

Correct Answer: 3. Concatenate two strings

Explanation: The ‘strcat’ function in C is used to concatenate (append) two strings.


Quiz 268:

Which of the following is the correct syntax for declaring a structure in C?

  1. struct MyStruct { /* members */ };
  2. structure MyStruct { /* members */ };
  3. type MyStruct { /* members */ };
  4. new struct MyStruct { /* members */ };

Correct Answer: 1. struct MyStruct { /* members */ };

Explanation: The correct syntax for declaring a structure in C is struct MyStruct { /* members */ };.


Quiz 269:

What does the ‘volatile’ keyword do when applied to a variable in C?

  1. Declares a constant value
  2. Extends the variable’s scope to the entire program
  3. Specifies that the variable is not modifiable
  4. Indicates that a variable may be changed at any time

Correct Answer: 4. Indicates that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.


Quiz 270:

Which operator is used for pointer dereferencing in C?

  1. *
  2. &
  3. ->
  4. %

Correct Answer: 1. *

Explanation: The * operator is used for pointer dereferencing in C.


Quiz 271:

What is the purpose of the ‘const’ keyword in C when applied to a pointer?

  1. Indicates a constant value
  2. Specifies that the pointer cannot be modified
  3. Declares a constant pointer
  4. Specifies that the pointed-to value is constant

Correct Answer: 4. Specifies that the pointed-to value is constant

Explanation: When ‘const’ is applied to a pointer in C, it indicates that the pointed-to value is constant and cannot be modified through that pointer.


Quiz 272:

Which function is used to allocate memory for an array dynamically in C?

  1. malloc()
  2. calloc()
  3. realloc()
  4. alloc()

Correct Answer: 2. calloc()

Explanation: The calloc() function in C is used to dynamically allocate memory for an array and initializes the allocated memory to zero.


Quiz 273:

What is the purpose of the ‘strlen’ function in C?

  1. Concatenate two strings
  2. Compare two strings
  3. Find the length of a string
  4. Copy one string to another

Correct Answer: 3. Find the length of a string

Explanation: The ‘strlen’ function in C is used to determine the length (number of characters) of a string.


Quiz 274:

Which operator is used for bitwise AND in C?

  1. &
  2. |
  3. ^
  4. << 

Correct Answer: 1. &

Explanation: The & operator is used for bitwise AND in C.


Quiz 275:

What is the purpose of the ‘return’ statement in a function in C?

  1. Exit the program
  2. Return a value from the function
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Return a value from the function

Explanation: The ‘return’ statement in C is used to send a value back from a function.


Quiz 276:

Which function is used to close a file in C?

  1. fclose()
  2. close()
  3. fileclose()
  4. shutfile()

Correct Answer: 1. fclose()

Explanation: The fclose() function is used to close a file in C after performing file operations.


Quiz 277:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 278:

What is the purpose of the ‘typedef’ keyword in C?

  1. Declare a new type name
  2. Define a constant value
  3. Specify the return type of a function
  4. Create an alias for a variable

Correct Answer: 1. Declare a new type name

Explanation: The ‘typedef’ keyword in C is used to create a new type name for an existing data type.


Quiz 279:

Which of the following is the correct syntax for declaring a function in C?

  1. def myFunction(): pass
  2. int myFunction() { /* code */ }
  3. void myFunction() { /* code */ }
  4. int myFunction(parameters) { /* code */ }

Correct Answer: 4. int myFunction(parameters) { /* code */ }

Explanation: The correct syntax for a function declaration in C includes the return type, function name, parameters, and the function body.


Quiz 280:

What is the purpose of the ‘union’ keyword in C?

  1. Declare a new type name
  2. Represent a collection of variables
  3. Create an empty function
  4. Allocate memory dynamically

Correct Answer: 2. Represent a collection of variables

Explanation: The ‘union’ keyword in C is used to represent a collection of variables that share the same memory location.


Quiz 281:

Which header file should be included to use the ‘scanf’ function in C?

  1. input.h
  2. output.h
  3. stdio.h
  4. stdlib.h

Correct Answer: 3. stdio.h

Explanation: The ‘scanf’ function is part of the Standard Input/Output library in C, and the header file stdio.h should be included.


Quiz 282:

What is the purpose of the ‘for’ loop in C?

  1. Execute a block of code at least once
  2. Iterate over a range of values
  3. Make decisions based on a condition
  4. Skip the current iteration and move to the next

Correct Answer: 2. Iterate over a range of values

Explanation: The ‘for’ loop in C is used to iterate over a range of values with a specified control structure.


Quiz 283:

Which operator is used for the modulo operation in C?

  1. %
  2. &
  3. |
  4. ^

Correct Answer: 1. %

Explanation: The % operator is used for the modulo operation in C, which returns the remainder of a division.


Quiz 284:

What does the ‘sizeof’ operator return when used with a pointer in C?

  1. Size of the pointer variable
  2. Size of the data type to which the pointer points
  3. Total size of the memory allocated for the pointer
  4. Size of the memory address held by the pointer

Correct Answer: 1. Size of the pointer variable

Explanation: When used with a pointer, the ‘sizeof’ operator in C returns the size of the pointer variable.


Quiz 285:

Which function is used to open a file in C for writing?

  1. fopen(“filename”, “r”)
  2. fopen(“filename”, “w”)
  3. fopen(“filename”, “a”)
  4. fopen(“filename”, “rb”)

Correct Answer: 2. fopen(“filename”, “w”)

Explanation: The fopen function with mode “w” is used to open a file in C for writing.


Quiz 286:

In C, what is the purpose of the ‘else’ statement?

  1. Declare a variable
  2. Specify an alternative block of code
  3. Loop through an array
  4. Terminate the program

Correct Answer: 2. Specify an alternative block of code

Explanation: The ‘else’ statement in C is used to specify an alternative block of code to be executed when the ‘if’ condition is false.


Quiz 287:

Which data type is used to store whole numbers in C?

  1. int
  2. float
  3. char
  4. double

Correct Answer: 1. int

Explanation: The int data type is used to store whole numbers in C.


Quiz 288:

What is the purpose of the ‘free’ function in C?

  1. Allocate memory dynamically
  2. Initialize memory to zero
  3. Deallocate memory
  4. Allocate memory for an array of elements

Correct Answer: 3. Deallocate memory

Explanation: The ‘free’ function in C is used to deallocate memory that was previously allocated dynamically using functions like ‘malloc’ or ‘calloc’.


Quiz 289:

Which header file should be included to use the ‘strlen’ function in C?

  1. string.h
  2. stdio.h
  3. stdlib.h
  4. math.h

Correct Answer: 1. string.h

Explanation: The ‘strlen’ function is part of the string manipulation functions in C, and the header file string.h should be included.


Quiz 290:

What is the purpose of the ‘goto’ statement in C?

  1. Exit the program
  2. Jump to a specified label within the program
  3. Make decisions based on a condition
  4. Loop through an array

Correct Answer: 2. Jump to a specified label within the program

Explanation: The ‘goto’ statement in C is used to transfer control to a specified label within the program.


Quiz 291:

Which operator is used for bitwise left shift in C?

  1. << 
  2. >> 
  3. &
  4. |

Correct Answer: 1. <<

Explanation: The << operator is used for bitwise left shift in C, which shifts the bits to the left.


Quiz 292:

What is the role of the ‘include’ directive in C?

  1. Define a new function
  2. Include external files in the program
  3. Declare a variable
  4. Print a message

Correct Answer: 2. Include external files in the program

Explanation: The ‘include’ directive in C is used to include external files in the program, often header files containing declarations.


Quiz 293:

Which of the following is the correct syntax for a function declaration in C?

  1. function MyFunction() { /* code */ }
  2. def MyFunction(): pass
  3. void MyFunction() { /* code */ }
  4. int MyFunction(int param);

Correct Answer: 4. int MyFunction(int param);

Explanation: The correct syntax for a function declaration in C includes the return type, function name, and parameter list.


Quiz 294:

What is the purpose of the ‘switch’ statement in C?

  1. Loop through a range of values
  2. Make decisions based on multiple conditions
  3. Create an infinite loop
  4. Define a constant value

Correct Answer: 2. Make decisions based on multiple conditions

Explanation: The ‘switch’ statement in C is used to make decisions based on the values of an expression.


Quiz 295:

Which of the following is the correct way to declare a pointer in C?

  1. int ptr;
  2. pointer int;
  3. int *ptr;
  4. ptr int;

Correct Answer: 3. int *ptr;

Explanation: The correct way to declare a pointer in C is by placing the asterisk (*) before the variable name.


Quiz 296:

In C, what is the purpose of the ‘break’ statement in a loop?

  1. Exit the program
  2. Exit the loop
  3. Skip the current iteration and move to the next
  4. Restart the loop from the beginning

Correct Answer: 2. Exit the loop

Explanation: The ‘break’ statement is used to exit a loop prematurely.


Quiz 297:

Which function is used to convert a string to an integer in C?

  1. atoi()
  2. itoa()
  3. strtoi()
  4. intToStr()

Correct Answer: 1. atoi()

Explanation: The atoi() function in C is used to convert a string to an integer.


Quiz 298:

What is the purpose of the ‘const’ keyword in a function declaration in C?

  1. Specify the return type
  2. Declare a constant variable
  3. Define a constant value
  4. Indicate a variable parameter

Correct Answer: 4. Indicate a variable parameter

Explanation: The ‘const’ keyword in a function declaration is used to indicate that a parameter is a constant.


Quiz 299:

Which of the following is a valid way to initialize an array in C?

  1. int myArray = {1, 2, 3};
  2. int myArray[] = {1, 2, 3};
  3. myArray = {1, 2, 3};
  4. int myArray[3] = {1, 2, 3};

Correct Answer: 2. int myArray[] = {1, 2, 3};

Explanation: The correct syntax for initializing an array in C is to use curly braces {} with the values enclosed.


Quiz 300:

What is the purpose of the ‘volatile’ keyword in C?

  1. Declare a constant value
  2. Specify the return type of a function
  3. Indicate that a variable may be changed at any time
  4. Create a dynamic variable

Correct Answer: 3. Indicate that a variable may be changed at any time

Explanation: The ‘volatile’ keyword in C is used to indicate that a variable’s value may be changed at any time by external forces.