Answers to Twitter Live quiz-3 on C


This is a recorded twitter quiz.
@ajlopez, won this quiz. More Details about this quiz
Follow Interview Mantra on twitter

  1. Question1:
    In C statement,
    int _new_var;
    The variable name is not valid and it results in a compilation error.
    a)True or b)False?

    Answer: b)False
    In C language, variable names can start with _(underscore) or a letter but not a number. Library routines are usually named with _(underscore) as first letter, so it is generally not recommended to start a variable name with underscore.

  2. Question2:
    In C, variable name hello is same as HELLO.
    a)True or b)False?

    Answer: b)False
    C language is case sensitive, so variable name ‘hello’ is not same as ‘Hello’ or ‘HELLO’.

  3. Question3: Mathematically,
    sizeof(short) <= sizeof(int) <= sizeof(long)
    a)True or b)False ?

    Answer: a)True
    In C, there is a restriction to the compiler that shorts and ints are at least 16 bits, longs are at least 32 bits. And short is no longer than int, which is no longer than long. Read more

  4. Question4: C statement,
    #define MAX 500
    is evaluated in
    a)compile time or b)run time ?

    Answer: a)compile time.
    #define is called a pre-processor directive, which means that even before compilation, it gets evaluated and replacement text 500 is replaced with MAX. Read more

  5. Question5:
    In C, ‘x’ is same as “x”.
    a)True or b)False ?

    Answer: b)False
    In C, ‘x’ is a character constant, whereas “x” is a string literal. “x” can be thought of as an array containing characters ‘x’ and ‘\0′ .

  6. Question6: In C, default value of a static variable is
    a)0 or b)garbage value?

    Answer: a)0
    In C, static variables and external variables are initialized to 0 by default. Read more

  7. Question7:
    In C, modulus operator(%) can be applied to float variables.
    a)True or b)False?

    Answer: b)False
    In C, modulus operator can only be applied to char or int data types. It can’t be applied to float or double.

  8. Question8:
    The C statement,
    enum number{ ONE=1, UNO=1 };
    fails compilation as the enum values are not distinct.
    a)True or b)False ?

    Answer: b)False
    In enum, values need not be distinct. But names in enum need to be distinct. Read more about enum

  9. Question9:
    In C, * (multiplication operator) has higher precedence than + or – operators.
    a)True or b)False?

    Answer: a)True
    The operators + and – have the same precedence, which is lower than that of *, /, % Read more about precedence of operators in C

  10. Question10:
    The default value of an automatic variable in C is
    a)0 or b)garbage value?

    Answer: b)garbage value
    Automatic variables are also called local variables. Their default value is always garbage value. Read more.


About the Author:  This post was written by Utsav Banerjee. You can reach Utsav on email at fugitiveland@gmail.com



All comments of post - "Answers to Twitter Live quiz-3 on C":

:Haha! I'am the first! Yeh~

Thank you!

Add a Comment / Trackback url

  1. #1  CaramoanNo Gravatar

    Twitter is some ways is much better than blogging. I love to Twitter my everyday activities on my friends and relatives.
    ***

    09/12/25 11:17

Show all Show 5 so far Close all

Comment begin from here or jump up!