OOPS interview questions

93 questions. Tap “Show answer” to check yourself.

Advertisement
  1. The storage class controls

    1. Scope of a variable
    2. Life time of a variable
    3. Both a and b
    4. None of above
    Show answer

    C. Both a and b

  2. Which of the following is not a valid reason for using functions?

    1. They use less memory than repeating the same code.
    2. They keep different program activities separate.
    3. They run faster.
    4. They keep variables safe from other parts of the program.
    Show answer

    C. They run faster.

  3. The C language provides a way to access contents of a file from a program using

    1. System calls
    2. Library function
    3. Both a and b
    4. None of above
    Show answer

    B. Library function

  4. The continue statement is used to

    1. Continue execution of the program error occurs.
    2. Exit from the outermost block even it is used in the innermost block.
    3. Exit the block of loop statement.
    4. Continue the next iteration of the loop statement.
    Show answer

    D. Continue the next iteration of the loop statement.

  5. The operators exclusively used with pointers are

    1. * and /
    2. & and *
    3. & and ^
    4. * and +
    Show answer

    B. & and *

  6. A structure is a data type in which

    1. Elements can be of different type.
    2. Each element must have the same type.
    3. Each element must be of pointer type.
    4. None of above
    Show answer

    A. Elements can be of different type.

  7. Preprocessor does not which one of the following?

    1. Macro expansion
    2. Conditional compilation
    3. Loading include file
    4. Type checking
    Show answer

    A. Macro expansion

  8. Which of the following statement is true about continue statement?

    1. It can be used in conjunction with switch statement.
    2. It terminates the loop.
    3. It terminates the current iteration.
    4. None of above
    Show answer

    C. It terminates the current iteration.

  9. Union differs from structure in the following way

    1. Only one member can be used at a time.
    2. Unions cannot have more than two members.
    3. Union initializes all members as structure.
    4. All members are used at a time.
    Show answer

    A. Only one member can be used at a time.

  10. Which of the following statement is true about register storage class?

    1. Variable always stored in processor registers.
    2. Can only be used with integral data types and pointers.
    3. Variable takes initial value 0 if not initialized.
    4. None of above
    Show answer

    B. Can only be used with integral data types and pointers.

  11. Which of the following statement is a correct statement about typedef statement?

    1. It is used to define a function.
    2. It is used to re-define a existing or user defined data type.
    3. It is primitive data type.
    4. None of above
    Show answer

    B. It is used to re-define a existing or user defined data type.

  12. Which of the following function will you use in case you want to provide the password facility in your program for security purposes?

    1. gets()
    2. scanf()
    3. getch()
    4. getchar()
    Show answer

    C. getch()

  13. Advertisement
  14. Which of the following function can be used to write only integer numbers

    1. putw()
    2. fwrite()
    3. putint()
    4. fprintf()
    Show answer

    A. putw()

  15. Which of the following statements is not true about floating point number to a string?

    1. ftoa()
    2. dtoa()
    3. gcvt()
    4. all of above
    Show answer

    C. gcvt()

  16. A bit field is of type

    1. double
    2. float
    3. int
    4. all of the above
    Show answer

    C. int

  17. The function ftell() returns

    1. the middle position of the file
    2. the current position of the file
    3. the end position of the file
    4. the beginning position of the file
    Show answer

    B. the current position of the file

  18. Which of the following function can be used to read an entire array or a structure in a single call?

    1. readblock()
    2. READ()
    3. read()
    4. fread()
    Show answer

    D. fread()

  19. Arrays are always passed as arguments to a function by

    1. depends on compiler optimization settings
    2. depends on the number of arguments
    3. value
    4. reference
    Show answer

    D. reference

  20. The function that allows a file to read randomly is

    1. frandon()
    2. rewind()
    3. ftell()
    4. fseek()
    Show answer

    D. fseek()

  21. Which of the following is not a control statement in C language?

    1. goto statement
    2. switch statement
    3. for statement
    4. repeat until statement
    Show answer

    D. repeat until statement

  22. Which of the following modifier is used to declare a variable as constant?

    1. const
    2. signed
    3. short
    4. unsigned
    Show answer

    A. const

  23. Which of the following string functions reverse the string?

    1. strrev()
    2. strcmp()
    3. strlen()
    4. strcpy()
    Show answer

    A. strrev()

  24. Operand of indirection operator is

    1. ordinary variable
    2. integer constant
    3. pointer variable
    4. none of above
    Show answer

    C. pointer variable

  25. Which of the following statements are true about break statement?

    1. The break statement terminates current iteration of the loop.
    2. The break statement can be used with if statement to terminate the execution of its block.
    3. The break statement can only be used with loop statements and switch statement.
    4. None of above
    Show answer

    C. The break statement can only be used with loop statements and switch statement.

  26. Advertisement
  27. Which of the following input function cannot be used to input multiword string in a single function call?

    1. getche()
    2. gets()
    3. scanf()
    4. None of above
    Show answer

    A. getche()

  28. Which of the following declarations is not correct?

    1. unsigned float d;
    2. unsigned char c;
    3. int b = 4;
    4. float a;
    Show answer

    A. unsigned float d;

  29. Which of the following operators has highest precedence?

    1. *
    2. /
    3. %
    4. All have same precedence
    Show answer

    D. All have same precedence

  30. What is the file extension for font files?

    1. txt
    2. bgi
    3. chr
    4. font
    Show answer

    C. chr

  31. Which of the following function can be used to write an entire array or a structure in a single call?

    1. writeblock()
    2. write()
    3. fwrite()
    4. WRITE()
    Show answer

    C. fwrite()

  32. File opening is a process of

    1. Writing data to a file
    2. Connecting program to a file
    3. Reading data from a file
    4. None of above
    Show answer

    B. Connecting program to a file

Advertisement