C MCQ Questions and Answers on Console IO and Formatted IO

Image

Study C MCQ Questions and Answers on Console Input and Output & Formatted Input and Output. Easily attend technical job interviews with these Multiple Choice Questions.

Go through C Theory Notes on Console IO and Formatted IO before attempting this test.



1) What is an Escape Sequence in C language.?
A) An escape sequence is a combination of two characters starting with Back Slash always.
B) An escape sequence is usually part of a string to tell compiler to produce New Lines, New tabs, Single or Double quotes etc
C) An escape sequence is used to format the output to look in desired way.
D) All the above
Answer [=]
Answer[=]
2) Choose a correct statement about C Escape Sequences.
A) \n produces new line.
B) \t produces one tab space (white spaces)
C) \b produces one Backspace
D) All the above
Answer [=]
Answer[=]
3) Choose a correct statement about C Escape Sequences.
A) \r produces one Carriage Return. \r does not take you to the next line. It takes cursor to only the beginning of same line.
B) \f produces form feed
C) \a produces Alert Sound or Beep Sound from PC motherboard speaker
D) All the above
Answer [=]
Answer[=]
4) Choose a correct statement about C Escape Sequences.
A) \' outputs one Single Quote. Right Single Quote.
B) \" outputs one Double Quote.
C) \\ produces one Visible Back Slash \.
D) All the above
Answer [=]
Answer[=]
5) What is a format specifier in C language.?
A) A format Specifier tells compiler to treat a variable value is predefined way.
B) Different format specifiers are used to print different type of data.
C) Format specifiers are used to write data to files in a formatted way.
D) All the above
Answer [=]
Answer[=]
6) Choose a valid C format specifier.?
A) %d prints integer constants
B) %u prints unsigned integer constants
C) %ld prints signed long and %lu prints unsigned long constants
D) All the above
Answer [=]
Answer[=]
7) Choose a correct statement about C format Specifiers.
A) %c prints unsigned or signed character constants.
B) %s prints string constants
C) %l or %L prints long constants.
D) All the above
Answer [=]
Answer[=]


 

8) Choose a correct statement about format specifiers.
A) %f prints float constants with 6 digits of precision
B) %lf prints double constants
C) %Lf prints long double constants
D) All the above
Answer [=]
Answer[=]
9) What does C format specifier %W.D represent.?
A) W represents total number of columns including precision digits.
B) D represents number of precision digits out of W columns.
C) Plus(+) before W.D is for Right Alignment. Minus(-) before W.D is for Left Alignment
D) All the above
Answer [=]
Answer[=]
10) Choose a C Formatted Input Output function below.
A) printf(), scanf()
B) sprintf(), sscanf()
C) fprintf(), fscanf()
D) All the above
Answer [=]
Answer[=]
11) Choose a C unformatted input output function below.
A) gets(), puts()
B) getchar(), putchar()
C) A & B
D) None of the above
Answer [=]
Answer[=]
12) What is the output of C program.?
int main()
{
    int a=123;
    printf("*%06d*",a);
    return 0;
}
A) *123*
B) *6123*
C) *000123*
D) *006123*
Answer [=]
Answer[=]
13) What is the output of C program.?
int main()
{
    int a=123456;
    printf("*%03d*",a);
    return 0;
}
A) *123*
B) *6123*
C) *123456*
D) *012345*
Answer [=]
Answer[=]
14) What is the output of C program.?
int main()
{
    int a=6543;
    printf("*%5d,*%-5d*",a,a);
    return 0;
}
A)
*56543,*56543*
B)
* 6543,*6543 *
C)
*6543 ,* 6543*
D)
*6543,*6543*
Answer [=]
Answer[=]


 

15) What is the output of C program.?
int main()
{
    float a=654.123456f;
    printf("%3.3f,%3.2f",a,a);
    return 0;
}
A) 654,654
B) 654.123456,654.123456
C) 654.123,654.12
D) 654.000,654.00
Answer [=]
Answer[=]
16) What is the output of C program.?
int main()
{
    char str[]="123";
    printf("*%4s*%-4s*",str,str);
    return 0;
}
A) *4123*4123*
B) * 123*123 *
C) *123 * 123*
D) *123*123*
Answer [=]
Answer[=]
17) Choose a correct statement about sprintf and sscanf functions.?
char str[20];
A) sprintf(str,"formatstring",variables) prints output to console. sscanf(str,"formatstring",&variables) scans keyboard input and copies to str.
B) sprintf(str,"formatstring",variables) prints output to string str. sscanf(str,"formatstring",&variables) scans keyboard input and prints to console
C) sprintf(str,"formatstring",variables) prints output to string str. sscanf(str,"formatstring",&variables) scans input from str itself and assigns data to &variables.
D) None of the above
Answer [=]
Answer[=]
18) What is the output of C program.?
int main()
{
    char ch='A';
    ch=getchar();
    putchar(ch);
    return 0;
}//input= S
A) A
B) B
C) S
D) Compiler error
Answer [=]
Answer[=]
19) Choose a correct C statement.?
A) SCANF can accept all types of data from keyboard including numbers and strings
B) GETS can accept only one String of any length and any number of words. GETCHAR can accept only one character constant from keyboard.
C) SCANF can accept only single word Strings
D) All the above
Answer [=]
Answer[=]
20) What is the output of c program with %* operator.?
int main()
{
    char kh;
    scanf("%*c %c",&kh);
    putchar(kh);
    return 0;
}//input=G H
A) G
B) H
C) A
D) Compiler error
Answer [=]
Answer[=]


Like or Share

Show some care. Like or Subscribe. [FB]...[Youtube]

C MCQ App by ExamTray 

Android APP

Java MCQ App by ExamTray 

Android APP
ALL MCQ App by ExamTray Android APP

Ad

 

Some good C Books

Book Price
1. C: The Complete Reference  Check Price
2. Let Us C Check Price
3. Programming in ANSI C Check Price
4. The C Programming Language Check Price

We may get some affiliate commission for the above purchases.