Fundamental C Test2

40 Questions | Attempts: 839
Share

SettingsSettingsSettings
C Programming Quizzes & Trivia

This test is to rate your fundamental C concepts


Questions and Answers
  • 1. 

    The process of removing a bug is known as

    • A.

      Debugging

    • B.

      Compilation

    • C.

      Executing

    • D.

      Running

    Correct Answer
    A. Debugging
  • 2. 

    Every C Program Statement must be terminated with a

    • A.

      .

    • B.

      #

    • C.

      ;

    • D.

      !

    Correct Answer
    C. ;
  • 3. 

    In the following which one is not a C keyword?

    • A.

      Choice

    • B.

      Case

    • C.

      For

    • D.

      Volatile

    Correct Answer
    A. Choice
  • 4. 

    What is the range of unsigned char data type

    • A.

      0 to 512

    • B.

      0 to 255

    • C.

      -128 to 127

    • D.

      -32, 768 to 32,767

    Correct Answer
    B. 0 to 255
  • 5. 

    C variable cannot start with

    • A.

      A lower case

    • B.

      An underscore

    • C.

      A number

    • D.

      An upper case letter

    Correct Answer
    C. A number
  • 6. 

    Which of the following is allowed in a C arithmetic statement

    • A.

      ( )

    • B.

      [ ]

    • C.

      { }

    • D.

      / /

    Correct Answer
    A. ( )
  • 7. 

    What is the result of 5 &&2 ?

    • A.

      0

    • B.

      2

    • C.

      1

    • D.

      5

    Correct Answer
    C. 1
  • 8. 

    ++I is a ----------------------operator.

    • A.

      Pre-decrement

    • B.

      Pre-increment

    • C.

      Post increment

    • D.

      Post decrement

    Correct Answer
    B. Pre-increment
  • 9. 

    Which of the following shows the correct hierarchy of arithmetic operations in C

    • A.

      ( ), &&, *,/,+,-

    • B.

      ( ), &&, / , *, +, -

    • C.

      ( ),&&,*or / + or -;

    • D.

      ( ), / or *, - or +

    Correct Answer
    D. ( ), / or *, - or +
  • 10. 

    The output of the following program is main( ) {int i=2; printf(“%d %d %d”,i++,i,++i); }

    • A.

      2 2 4

    • B.

      2 3 3

    • C.

      3 3 3

    • D.

      2 3 4

    Correct Answer
    C. 3 3 3
  • 11. 

    In switch (expression) statement, the expression should evaluate to

    • A.

      A void

    • B.

      An integer

    • C.

      A character

    • D.

      A float

    Correct Answer
    B. An integer
  • 12. 

    How many while statements are possible in do.... While loop?

    • A.

      Any number

    • B.

      2

    • C.

      3

    • D.

      1

    Correct Answer
    A. Any number
  • 13. 

    What type of errors are checked during compilation

    • A.

      Divide by zero error

    • B.

      Logical errors

    • C.

      Run - time errors

    • D.

      Syntax errors

    Correct Answer
    D. Syntax errors
  • 14. 

    Which of the following is a valid numeric constant

    • A.

      20,000

    • B.

      15 750

    • C.

      $1000

    • D.

      65432

    Correct Answer
    D. 65432
  • 15. 

    What is range of char data value?

    • A.

      -128 to 127

    • B.

      -64 to 64

    • C.

      0 to 255

    • D.

      -127 to 128

    Correct Answer
    A. -128 to 127
  • 16. 

    Which of the following is the assignment operator in C

    • A.

      !=

    • B.

      = =

    • C.

      =

    • D.

      : =

    Correct Answer
    C. =
  • 17. 

    The equality relational operator is represent by

    • A.

      :=

    • B.

      ==

    • C.

      .EQ

    • D.

      =

    Correct Answer
    B. ==
  • 18. 

    main( ) { int a=0; if(a) printf(“%d”,++a); else printf(“%d”, a+=2) ; } the output is

    • A.

      3

    • B.

      1

    • C.

      2

    • D.

      0

    Correct Answer
    C. 2
  • 19. 

    x=9-12/3+3*2-1, what is the value of x

    • A.

      -10

    • B.

      10

    • C.

      4

    • D.

      2

    Correct Answer
    B. 10
  • 20. 

    The function -------------------echoes the character typed on the screen

    • A.

      Getchar()

    • B.

      Gets()

    • C.

      Getche()

    • D.

      Getchr()

    Correct Answer
    C. Getche()
  • 21. 

    Size of (double) returns———

    • A.

      8

    • B.

      2

    • C.

      10

    • D.

      4

    Correct Answer
    A. 8
  • 22. 

    The symbol for right shift operator is

    • A.

      − >

    • B.

      >

    • C.

    • D.

      >>

    Correct Answer
    D. >>
  • 23. 

    What function is appropriate for accepting a string?

    • A.

      Getch ( )

    • B.

      Gets( )

    • C.

      Getche ( )

    • D.

      Scanf ( )

    Correct Answer
    B. Gets( )
  • 24. 

    ‘void’ means

    • A.

      1

    • B.

      Nothing

    • C.

      Something not known

    • D.

      0

    Correct Answer
    B. Nothing
  • 25. 

    How would you declare a constant of 5 called “MYCONST”?

    • A.

      #define MYCONST 5

    • B.

      Var int MYCONST=5

    • C.

      Int myconst = 5;

    • D.

      Constant MYCONST = 5;

    Correct Answer
    A. #define MYCONST 5
  • 26. 

    What symbol is used to represent input/output operations in a flow chart.

    • A.

      Rectangles

    • B.

      Parellograms

    • C.

      Circles

    • D.

      Rectangle with rounded end

    Correct Answer
    B. Parellograms
  • 27. 

    Which of the following is not a key word of C?

    • A.

      Main

    • B.

      Void

    • C.

      Const

    • D.

      Sizeof

    Correct Answer
    A. Main
  • 28. 

    The keyword is used to define a new data type.

    • A.

      Array

    • B.

      Structure

    • C.

      Typedef

    • D.

      Union

    Correct Answer
    C. Typedef
  • 29. 

    The purpose of the following fragment B=S+B S=B-S; B=B-S; Where S,B are two integers is to

    • A.

      Negate the contents of S and B

    • B.

      Swap the contents of S and B

    • C.

      Transfer the contents of S to B

    • D.

      Transfer the contents of B to S

    Correct Answer
    B. Swap the contents of S and B
  • 30. 

    main( ) { float a; int x = 6; y = 4; a = x/y; print (“%f”,a) }what is the output

    • A.

      Error

    • B.

      1.5

    • C.

      0.5

    • D.

      1.00

    Correct Answer
    D. 1.00
  • 31. 

    What is output of following Program? main( ) {int x=10,y=5,p,q ; p= x> 9 ; q= x > 3 && y != 3 ; printf( “p=%d q=%d ” ,p,q) ; }

    • A.

      P =0 q = 0

    • B.

      P = 0 q = 1

    • C.

      P = 1 q= 0

    • D.

      P = 1 q = 1

    Correct Answer
    D. P = 1 q = 1
  • 32. 

    Format specifier for the string is

    • A.

      %u

    • B.

      %d

    • C.

      %c

    • D.

      %s

    Correct Answer
    D. %s
  • 33. 

    The conditional operators “ ? :” is similar to

    • A.

      Nested if

    • B.

      If-then-else

    • C.

      While

    • D.

      Do-while

    Correct Answer
    B. If-then-else
  • 34. 

    C language has been developed by

    • A.

      Martin Richards

    • B.

      Ken Thompson

    • C.

      Peter Norton

    • D.

      Dennis Ritchie

    Correct Answer
    D. Dennis Ritchie
  • 35. 

     Which function returns single character

    • A.

      Printf

    • B.

      Putchar

    • C.

      Scanf

    • D.

      Getchar

    Correct Answer
    D. Getchar
  • 36. 

    Pick the operators that associates from right to left

    • A.

      %

    • B.

      -

    • C.

      =

    • D.

      +

    Correct Answer
    C. =
  • 37. 

    Among the following operators, whose associatively is right to left

    • A.

      Logical operators

    • B.

      Arithmetic operators

    • C.

      Conditional expression

    • D.

      Bitwise operators

    Correct Answer
    C. Conditional expression
  • 38. 

    What could be output of the following function main( ) {int x=2,y=6,z=6; x=y=z; printf(“%d”,x); }

    • A.

      2

    • B.

      1

    • C.

      0

    • D.

      6

    Correct Answer
    D. 6
  • 39. 

    switch(ch) {case ‘a’: printf(“a”); case ‘b’: printf(“b”); default: printf(“error”); } if ch is assigned to the character ‘a’ then the output will be

    • A.

      A b

    • B.

      A b error

    • C.

      A

    • D.

      Error

    Correct Answer
    B. A b error
  • 40. 

    Which of the following cannot be used as an identifier.

    • A.

      Alphabet followed by digit

    • B.

      Keywords

    • C.

      Alphabet

    • D.

      Library function name

    Correct Answer
    B. Keywords

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jul 30, 2011
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 06, 2010
    Quiz Created by
    Sudha_test
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.