What term is used to describe the process of calling a function within itself?

  • Casting
  • Looping
  • Recursion
  • Structuring
The process of calling a function within itself is known as "recursion." It allows for solving problems that can be broken down into smaller, similar subproblems.

The strlen function returns the length of a string, excluding the ________.

  • null terminator
  • first character
  • whitespace characters
  • special characters
The correct answer is the null terminator. The strlen function in C/C++ returns the length of a string by counting characters until it encounters the null terminator (''). It excludes the null terminator from the count. The other options are not what strlen excludes.

The C function ________ is used to compare two strings lexicographically.

  • strcmp
  • strncmp
  • strcompare
  • strcasecmp
The correct answer is strcmp. This function compares two strings character by character and returns an integer value representing their lexicographical order. strncmp is used for comparing a specific number of characters, and the other options are not valid C functions.

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.

When working with large datasets, using pointers to structures can help in reducing ________ overhead.

  • Computational
  • Memory
  • Processing
  • Storage
Pointers to structures in C can help reduce memory overhead, as they allow for more efficient memory management and allocation, especially when dealing with large datasets.

The ________ function is used to move the file pointer to a specified position in a file.

  • moveptr()
  • fseek()
  • setposition()
  • positionfile()
The correct option is b) fseek(). This function in C is used to move the file pointer to a specified position in the file. It takes the file pointer, offset, and origin as arguments.

The function ________ is used to copy one string to another in C.

  • compare()
  • length()
  • strcpy()
  • swap()
In C, the function strcpy() is used to copy one string to another. It takes two string arguments and copies the contents of the source string to the destination string until it encounters a null character.

Which sorting algorithm is most efficient when dealing with small datasets or partially sorted data?

  • Bubble Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
Insertion Sort is efficient for small datasets and partially sorted data due to its simplicity and low overhead.

Which operator is used to access the value stored at the address specified by a pointer?

  • &
  • *
  • ->
  • .
The '*' operator in C is used to access the value stored at the address specified by a pointer. It is also known as the dereference operator. The '&' operator is used to get the address of a variable, not the value.

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.