Thursday, 9 November 2017

Printf Questions in C

-------------------------------------------------------------------------------------------------------------
Next Page                                                    Last Page
-------------------------------------------------------------------------------------------------------------

1.
What is the output of this C code?

#include
    int main()
    {
        char c = '�';
        putchar(c);
    }

A. Compile time error
B. Nothing
C. 0
D. Undefined behaviour

Answer: B
------------------------------------------------------------------------------------------------------

2.
The statement prog

A. prog to read characters from infile.
B. prog to write characters to infile.
C. infile to read characters from prog instead.
D. nothing

Answer: A
-------------------------------------------------------------------------------------------------------

3.
What is the output?

#include
    int main(int argc, char **argv)
    {
        char c = 'd';
        putchar(c);
        printf(" %d\n", argc);
    }

A. d 2 in myfile
B. d 1 in myfile
C. Depends on the system
D. Depends on the standard

Answer: B
---------------------------------------------------------------------------------------------------

4.
Which is true about function tolower?

A. The function tolower is defined in 
B. Converts an upper case letter to lower case
C. returns other characters untouched
D. None of the mentioned

Answer: D
--------------------------------------------------------------------------------------------------

5.
Which among the following is odd one out?

A. printf
B. fprintf
C. putchar
D. scanf

Answer: D
--------------------------------------------------------------------------------------------------
Next Page                                         Last Page
--------------------------------------------------------------------------------------------------

More Imp Topics:

Data Types       
Operators
Pointers
Array
Preprocessor
Structures
Control Structures
Switch Case

100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...