Tag: programming languages

Questions Related to programming languages

You can override private virtual methods?

  1. True

  2. False


Correct Option: B

Vector.size() refers to the space alloted to the vector

  1. True

  2. False


Correct Option: B
  1. I/O operation

  2. Database operation

  3. Networking

  4. All of the above

  5. None of the above


Correct Option: D
  1. Sequence Output Stream

  2. Print Stream

  3. None of the above

  4. 1 and 2


Correct Option: C,D
  1. Resultset

  2. Prepared Statement

  3. Statement

  4. Number of rows retrieved


Correct Option: D
  1. Flow Layout

  2. GridLayout

  3. Card Layout

  4. BorderLayout

  5. GridBagLayout


Correct Option: D
  1. f == EOF

  2. feof( f )

  3. eof( f )

  4. f == NULL


Correct Option: A
Explanation:

To determine if the end of a file has been reached, we need to check the return value of the read operation. In the given code, the file is opened using fopen and then readData is called to read from the file. After that, we need to check if the end of the file has been reached.

Option A) f == EOF - This option is correct because it checks if the file pointer f is equal to the constant EOF (End of File). If the end of the file has been reached, the read operation will return EOF, and this condition will evaluate to true.

Option B) feof(f) - This option is incorrect. The feof function is used to check if the end-of-file indicator is set for the given file stream. It does not directly indicate if the end of the file has been reached after a read operation.

Option C) eof(f) - This option is incorrect. The eof function is not a standard function in C. It is not used to check if the end of a file has been reached.

Option D) f == NULL - This option is incorrect. The f pointer is obtained from fopen and is checked for NULL to ensure that the file was successfully opened. It does not indicate if the end of the file has been reached.

The correct answer is Option A) f == EOF. This option correctly checks if the end of the file has been reached after a read operation.

Therefore, the correct answer is Option A.

  1. int *ptr = (int *) malloc(10, sizeof(int));

  2. int *ptr = (int *) calloc(10, sizeof(int));

  3. int *ptr = (int *) malloc(10*sizeof(int));

  4. int *ptr = (int *) alloc(10*sizeof(int));


Correct Option: C