C+ Aptitude Exam: Quiz!

40 Questions | Total Attempts: 54

SettingsSettingsSettings
Please wait...
C+ Aptitude Exam: Quiz!

.


Questions and Answers
  • 1. 
    Which of the following is the correct order of evaluation for the below expression? z = x + y * z / 4 % 2 - 1
    • A. 

      * / % + - =

    • B. 

      = * / % + -

    • C. 

      / * % - + =

    • D. 

      * % / - + =

  • 2. 
    Which of the following correctly shows the hierarchy of arithmetic operations in C?
    • A. 

      / + * -

    • B. 

      * - / +

    • C. 

      + - / *

    • D. 

      / * + -

  • 3. 
    In which order do the following gets evaluated 1. Relational 2. Arithmetic 3. Logical 4. Assignment
    • A. 

      2134

    • B. 

      1234

    • C. 

      4321

    • D. 

      3214

  • 4. 
    Which of the following is the correct usage of conditional operators used in C?
    • A. 

      A>b ? c=30 : c=40;

    • B. 

      A>b ? c=30;

    • C. 

      Max = a>b ? a>c?a:c:b>c?b:c

    • D. 

      Return (a>b)?(a:b)

  • 5. 
    What will the function rewind() do?
    • A. 

      Reposition the file pointer to a character reverse.

    • B. 

      Reposition the file pointer stream to end of file

    • C. 

      Reposition the file pointer to beginning of that line

    • D. 

      Reposition the file pointer to beginning of file.

  • 6. 
    Input/output function prototypes and macros are defined in which header file?
    • A. 

      Conio.h

    • B. 

      Stdlib.h

    • C. 

      Stdio.h

    • D. 

      Dos.h

  • 7. 
    Which standard library function will you use to find the last occurrence of a character in a string in C?
    • A. 

      Strnchar()

    • B. 

      Strchar()

    • C. 

      Strrchar()

    • D. 

      Strrchr()

  • 8. 
    What is stderr?
    • A. 

      Standard error

    • B. 

      Standard error types

    • C. 

      Standard error streams

    • D. 

      Standard error definitions

  • 9. 
    What is the purpose of fflush() function?
    • A. 

      Flushes all streams and specified streams.

    • B. 

      Flushes only specified stream

    • C. 

      Flushes input/output buffer

    • D. 

      Flushes file buffer

  • 10. 
    What will the function randomize() do in Turbo C under DOS?
    • A. 

      Returns a random number

    • B. 

      Returns a random number generator in the specified range.

    • C. 

      Returns a random number generator with a random value based on time

    • D. 

      Return a random number with a given seed value

  • 11. 
    In which numbering system can the binary number 1011011111000101 be easily converted to?
    • A. 

      Decimal system

    • B. 

      Hexadecimal system

    • C. 

      Octal system

    • D. 

      No need to convert

  • 12. 
    Which bitwise operator is suitable for turning on a particular bit in a number?
    • A. 

      && operator

    • B. 

      & operator

    • C. 

      || operator

    • D. 

      | operator

  • 13. 
    Which header file should be included to use functions like malloc() and calloc()?
    • A. 

      Memory.h

    • B. 

      Stdlib.h

    • C. 

      String.h

    • D. 

      Dos.h

  • 14. 
    What function should be used to free the memory allocated by calloc() ?
    • A. 

      Dealloc();

    • B. 

      Malloc(variable_name, 0)

    • C. 

      Free();

    • D. 

      Memalloc(variable_name, 0)

  • 15. 
    What are the different types of real data types in C?
    • A. 

      Float, double

    • B. 

      Short int, double, long int

    • C. 

      Float, double, long double

    • D. 

      Double, long int, float

  • 16. 
    What will you do to treat the constant 3.14 as a long double?
    • A. 

      Use 3.14LD

    • B. 

      Use 3.14L

    • C. 

      Use 3.14DL

    • D. 

      Use 3.14LF

  • 17. 
    We want to round off x, a float, to an int value, The correct way to do is
    • A. 

      Y = (int)(x + 0.5)

    • B. 

      Y = int(x + 0.5)

    • C. 

      Y = (int)x + 0.5

    • D. 

      Y = (int)((int)x + 0.5)

  • 18. 
    The binary equivalent of 5.375 is
    • A. 

      101.101110111

    • B. 

      101.011

    • C. 

      101011

    • D. 

      None of above

  • 19. 
    Which of the following function sets first n characters of a string to a given character?
    • A. 

      Strinit()

    • B. 

      Strnset()

    • C. 

      Strset()

    • D. 

      Strcset()

  • 20. 
    If the two strings are identical, then strcmp() function returns
    • A. 

      -1

    • B. 

      1

    • C. 

      0

    • D. 

      Yes

  • 21. 
    Which of the following function is used to find the first occurrence of a given string in another string?
    • A. 

      Strchr()

    • B. 

      Strrchr()

    • C. 

      Strstr()

    • D. 

      Strnset()

  • 22. 
    Which of the following function is more appropriate for reading in a multi-word string?
    • A. 

      Printf();

    • B. 

      Scanf();

    • C. 

      Gets();

    • D. 

      Puts();

  • 23. 
    How will you print \n on the screen?
    • A. 

      Printf("\n");

    • B. 

      Echo "\\n";

    • C. 

      Printf('\n');

    • D. 

      Printf("\\n");

  • 24. 
    Is standard library a part of C language?
    • A. 

      Yes

    • B. 

      No

  • 25. 
    The library function used to find the last occurrence of a character in a string is
    • A. 

      Strnstr()

    • B. 

      Laststr()

    • C. 

      Strrchr()

    • D. 

      Strstr()