C Language

Test your knowledge of C programming fundamentals including operators, functions, structures, bit fields, and file handling.

13 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following statements is not true?

  1. getchar() reads one character at a time till the user presses enter.
  2. putchar() prints one character on the screen at a time, read by the standard input.
  3. getch() reads alphanumeric character from the input device.
  4. getch() does not display the character input by it on the screen.
  5. All of the above
Question 2 Multiple Choice (Single Answer)

Which of the following statements is/are true for the “structures” in C language?

  1. We cannot create nesting of “structures” in a C program.
  2. By default, all the member structures are private.
  3. We can pass a structure element to a function.
  4. Both 1 and 3
  5. Both 2 and 3
Question 3 Multiple Choice (Single Answer)

Find out the output of the given program in binary language.

#include <stdio.h>
#include <conio.h>
int main() {
  int a = 7, b = 15, c;
  c = a | b;
  printf("The result comes out to be : %d", c);
  getch();
}
  1. The result comes out to be 0111.
  2. The result comes out to be 1111.
  3. The result comes out to be 0111.
  4. The result comes out to be 0110.
  5. Error in the program
Question 4 Multiple Choice (Single Answer)

Which of the following options is true for functions in C language?

  1. Functions operate on actual address argument and return the address back to the calling function.
  2. The values of formal arguments passed by the calling function are received by the actual arguments of the called function.
  3. The detail of inner working of a function is known to the whole program.
  4. A class can always access the functions of another class with friend function.
  5. None of these
Question 5 Multiple Choice (Single Answer)

Which of the following statements is/are true regarding the making of a program to store the data using “bit fields” in C language?

  1. Array of bit fields are not permitted.
  2. Pointer cannot be used for addressing the bit fields directly.
  3. We can use only unsigned integer data type with bit fields.
  4. A bit field is set up with a structure declaration.
  5. All of the above
Question 6 Multiple Choice (Single Answer)

Which of the following symbols is used for the comparison of two values?

  1. ==
  2. &&
  3. ++
  4. --
  5. +
Question 7 Multiple Choice (Single Answer)

Which of the following is not an object-oriented programming language?

  1. C
  2. C++
  3. C#
  4. Java
  5. F#
Question 8 Multiple Choice (Single Answer)

Which of the following is a unary operator?

  1. &&
  2. ||
  3. >=
  4. ++
  5. <=
Question 9 Multiple Choice (Single Answer)

Which of the following standard functions accepts two arguments while calling?

  1. Strspn();
  2. Strnset();
  3. Strnsetu();
  4. Strdup();
  5. Strncpyl();
Question 10 Multiple Choice (Single Answer)

Which of the following is a bitwise operator?

  1. !=
  2. &
  3. ==
  4. <
  5. >
Question 11 Multiple Choice (Single Answer)

With which boolean operator is logical AND denoted?

  1. &&
  2. ||
  3. >=
  4. <=
  5. !
Question 12 Multiple Choice (Single Answer)

Which of the following options is correct for file handling?

  1. Random access file takes less time for reading than a sequential file.
  2. getw() function reads all data types from a file.
  3. Closall() function closes all the opened files in a program.
  4. ofstream is a class to read the data from a file.
  5. None of these
Question 13 Multiple Choice (Single Answer)

Find out the output of the given program.

#include <stdio.h>
#include <conio.h>
main()
{
    int s = 25, d;
    d = s % 10;
    if (d == 5) {
        s = s / 10;
        printf("\\nresult is=%d%d", s * s++, d * d);
    }
    else {
        printf("\\n invalid number");
    }
    getch();
}
  1. Invalid number
  2. 425
  3. 625
  4. 525
  5. Compiler error