Skill Test

12 Questions | Attempts: 170
Share
SettingsSettings
Please wait...
  • 1/12 Questions

     Which is correct with respect to size of the datatypes?

    • Char > int > float
    • Int > char > float
    • Char < int < double
    • Double > char > int
Please wait...
About This Quiz

Skill Test is a unique platform to assess your skills and showcase your expertise.

Skill Assessment Quizzes & Trivia

Quiz Preview

  • 2. 

    What is the output of this C code?
    1. #include
    2. int main()
    3. {
    4. enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};
    5. printf("PEACH = %d\n", PEACH);
    6. }

    • PEACH = 3

    • PEACH = 4

    • PEACH = 5

    • PEACH = 6

    Correct Answer
    A. PEACH = 5
    Explanation
    In enum, the value of constant is defined to the recent assignment from left.

    Rate this question:

  • 3. 

    What is the output of this C code?
    1. #include
    2. void foo(const int *);
    3. int main()
    4. {
    5. const int i = 10;
    6. printf("%d ", i);
    7. foo(&i);
    8. printf("%d", i);
    9.  
    10. }
    11. void foo(const int *i)
    12. {
    13. *i = 20;
    14. }

    • Compile time error

    • 10 20

    • Undefined value

    • 10

    Correct Answer
    A. Compile time error
    Explanation
    Cannot change a const type value.

    Rate this question:

  • 4. 

    What is the output of this C code?
    1. #include <stdio.h>
    2. int main()
    3. {
    4. int a = 1, b = 1, d = 1;
    5. printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++);
    6. }

    • 9, 6, 9

    • 15, 4, 5

    • 9, 3, 5

    • 6, 4, 6

    Correct Answer
    A. 15, 4, 5
  • 5. 

    Does this compile without error?
    1. #include <stdio.h>
    2. int main()
    3. {
    4. int k;
    5. {
    6. int k;
    7. for (k = 0; k < 10; k++);
    8. }
    9. }

    • Yes

    • No

    • Depends on the compiler

    • Depends on the C standard implemented by compilers

    Correct Answer
    A. Yes
    Explanation
    There can be blocks inside block and within blocks variables have only block scope.

    Rate this question:

  • 6. 

    What is the output of this C code?
    1. #include <stdio.h>
    2. void main()
    3. {
    4. int k;
    5. for (k = -3; k < -5; k++)
    6. printf("Hello");
    7. }

    • Run time error

    • Infinite hello

    • Nothing

    • Hello

    Correct Answer
    A. Nothing
  • 7. 

    What is the output of this C code?
    1. #include <stdio.h>
    2. int main()
    3. {
    4. j = 10;
    5. printf("%d\n", j++);
    6. return 0;
    7. }

    • 10

    • 11

    • Compile time error

    • 0

    Correct Answer
    A. Compile time error
    Explanation
    Variable j is not defined.

    Rate this question:

  • 8. 

     What is the output of this C code?
    1. #include <stdio.h>
    2. void main()
    3. {
    4. int x = 97;
    5. char y = x;
    6. printf("%c\n", y);
    7. }

    • A

    • B

    • 97

    • Run time error

    Correct Answer
    A. A
  • 9. 

    1. What is the output of this C code? #include <stdio.h>
    2. int main()
    3. {
    4. int var = 010;
    5. printf("%d", var);
    6. }

    • 2

    • 8

    • 10

    • 9

    Correct Answer
    A. 8
    Explanation
    010 is octal representation of 8.

    Rate this question:

  • 10. 

     Which of the following declaration is not supported by C?

    • String str;

    • Char *str;

    • float str = 3e2;

    • Both (a) and (c)

    Correct Answer
    A. String str;
    Explanation
    It is legal in Java, not in C.

    Rate this question:

  • 11. 

    What is the output of this C code?
    1. #include <stdio.h>
    2. void main()
    3. {
    4. int x = 0;
    5. if (x = 0)
    6. printf("Its zero\n");
    7. else
    8. printf("Its not zero\n");
    9. }

    • Its zero

    • Run time error

    • Its not zero

    • None

    Correct Answer
    A. Its not zero
  • 12. 

    What is the output of this C code?
    1. #include
    2. int main()
    3. {
    4. int x = 0;
    5. if (x++)
    6. printf("true\n");
    7. else if (x == 1)
    8. printf("false\n");
    9. }

    • Undefined behaviour

    • Compile time error

    • False

    • True

    Correct Answer
    A. Compile time error

Quiz Review Timeline (Updated): Aug 24, 2017 +

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

  • Current Version
  • Aug 24, 2017
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 25, 2013
    Quiz Created by
    Prabhaforritari
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.