The data type ________ is used in C to store a single character.

  • char
  • character
  • double
  • int
In C, the 'char' data type is used to store a single character. It can hold a single character, such as a letter or a symbol, within single quotes.

How are the members of a structure accessed in C?

  • By using the arrow (->) operator
  • By using the dollar sign ($)
  • By using the dot (.) operator
  • By using the exclamation mark (!)
In C, structure members are accessed using the dot (.) operator. This allows you to access the individual fields within a structure.

You are debugging a C program and notice that a variable intended to store large numbers is not holding the values correctly. What might be the issue with the data type used?

  • The issue might be with using an int data type.
  • The issue might be with using a float data type.
  • The issue might be with using a double data type.
  • The issue might be with using a short data type.
The correct option is 3. When dealing with large numbers, it's more appropriate to use a double data type because it provides greater precision compared to int and float, which may result in loss of precision for large numbers. short data type is typically used for smaller integers.

The function ________ is used to write data to a binary file.

  • binary_write()
  • fread()
  • fwrite()
  • write()
The correct function to write data to a binary file in C is fwrite(). It is designed to write a specified number of elements to a binary file, making it an essential function for handling binary data.

The function fopen in C opens a file and returns a pointer of type ________.

  • FILE*
  • char*
  • double
  • int
In C, the fopen function is used to open a file and returns a pointer of type FILE*, which represents the file stream.

The size of a structure in memory is determined by the ________ of its members.

  • maximum
  • minimum
  • sum
  • total
The size of a structure in memory is determined by the total size of its members. This includes the size of all individual data members within the structure.

Using the ________ keyword before a function suggests to the compiler that the function should be expanded at the point where it is called.

  • Dynamic
  • Inline
  • Static
  • Virtual
The "inline" keyword suggests to the compiler that the function should be expanded at the call site for performance optimization.

What is the significance of the SEEK_SET, SEEK_CUR, and SEEK_END constants in file handling?

  • File attributes
  • File permissions
  • File positioning
  • File type
In file handling, the SEEK_SET, SEEK_CUR, and SEEK_END constants are used to define the reference point for file positioning. SEEK_SET sets the file position from the beginning of the file, SEEK_CUR sets it relative to the current position, and SEEK_END sets it relative to the end of the file. These constants are crucial for accurate file positioning and seeking within files.

In C, to close a file opened by fopen, the function ________ is used.

  • close
  • fclose
  • fflush
  • remove
In C, the fclose function is used to close a file that was opened with fopen. It's essential to free resources and ensure data is written.

What is the purpose of an array in C?

  • To create functions
  • To perform arithmetic operations
  • To store a single value
  • To store multiple values of the same data type
The purpose of an array in C is to store multiple values of the same data type in a contiguous memory block, making it easier to work with collections of data.