Machine-translated by Google. Questions are authored in English.
Top

Input and Output Questions and Answers

1.

Consider the following ‘C’ fragment of code where a, b, c is given as input then predict the output from the following :

. . .
char x, y, z;
printf (‘‘%d’’, scanf (‘‘%c%c%c’’, &x, &y, &z));

Exam Year(s)

MH SET - 2019, SET Exam - 2019,

Answer: D

The program shows 3 at output.

The inner call scanf("%c%c%c", &x, &y, &z) is evaluated first. It reads three characters from the input into x, y and z. scanf returns the number of input items successfully assigned, which is 3. That return value is then the argument of printf with the %d format, so printf prints 3.

The code is valid C, so there is no syntax error, and the arguments are proper addresses of char variables, so there is no fatal error or segmentation violation. Whatever characters are typed, three successful %c conversions give 3.

Please log in or register to report this question.

2.

What is the output of the following program ?

#include\(\lt\)stdio.h\(\gt\)
main()
{
fprintf(stdout,"Hello, World!") ;
}

Exam Year(s)

Tripura Public Service Commission - 2019,

Answer: C

The answer given by the Commission's key is Compile error (option C).

The program omits the return type of main(). Before the C99 standard such a declaration meant int main(), and an old compiler would print Hello, World! and exit. C99 and later removed that implicit int rule, so under a conforming modern compiler the declaration is an error or at best a diagnosed extension, and the key reads the program that way. The call fprintf(stdout, ...) is itself valid and is not the cause.

Option A is what a pre-C99 compiler would print, and it is why the question is open to debate; the keyed answer rests on the current standard. No output is wrong because stdout is flushed when the program ends, and runtime error is wrong because nothing in the program fails when it runs.

Please log in or register to report this question.

3.

In scanf, what is the primary role of format specifiers like %d and %f ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: B

Format specifiers in scanf specify the type and format of input to be read.

In scanf("%d", &x), the %d tells scanf to read characters from the input and convert them as a decimal integer; %f reads a floating-point number, %c a character and %s a string. The converted value is then stored at the address supplied.

The storage itself is fixed by the variable's declared type, not by the specifier, and the specifier allocates no space: the variable must already exist. Format specifiers have nothing to do with the program's flow of control.

Please log in or register to report this question.

4.

What will be the output of the following statement ?

int a = 10; printf("%d &i", a,10);

Exam Year(s)

Tripura Public Service Commission - 2019,

Answer: D

The output is 10 &i, so the answer is None of the above.

The format string "%d &i" contains only one conversion specifier, %d, which prints the value of a, 10. The rest, a space followed by the characters &i, is ordinary text and is printed as it stands. The extra argument 10 has no specifier to use it and is ignored; C allows surplus arguments to printf.

'10 10' would be the output of "%d %i"; with & instead of % the second number is never printed. The statement compiles, so it is not an error.

Please log in or register to report this question.

Answer: C

Correct answer: A control unit and an arithmetic/logic unit.

The CPU is conventionally described as those two parts. The control unit fetches, decodes and sequences instructions; the arithmetic and logic unit performs the calculations and comparisons.

Registers are usually counted with them, and modern processors add cache and several execution units, but the two-part description remains the standard model. Card readers and printers are peripherals, outside the processor entirely, and "analytical engine" is Babbage's term for a whole machine.

Please log in or register to report this question.

6.

Which of the following is capable of recognizing a pre-specified type of mark by pencil or pen?

Answer: A

Correct answer: OMR

Optical mark recognition detects the presence or absence of a mark in a predefined position, which is why the forms it reads have printed boxes or lozenges to be filled.

It reads position rather than shape, which makes it simple and very reliable - and is why it is used for examination answer sheets, ballot papers and survey forms. Optical character recognition, by contrast, must identify the shapes of characters, a far harder problem. A bar code reader reads bar widths, and Winchester is an old term for a hard disk.

Please log in or register to report this question.

Answer: A

Correct answer: Input

An input device is the one through which information is put into the machine - keyboard, mouse, scanner, microphone. Output devices deliver results in the opposite direction.

Please log in or register to report this question.

Answer: C

Correct answer: Text, Graphics, Video, and Audio

Output is anything the computer presents to the user, and it takes all four forms - text and graphics on a display or printer, video as moving images, audio through speakers.

The other options are all subsets, and each omits something a modern system produces routinely. The breadth is what drove the term "multimedia" and the hardware that supports it: sound cards, graphics processors and high-bandwidth display interfaces all exist because output is not confined to text.

Please log in or register to report this question.

9.

A multifunction Device (MFD) are also called

Answer: A

Correct answer: All-in-one devices

The two names describe the same product: a single unit combining printing, scanning, copying and often faxing.

"All-in-one" is the marketing term and "multifunction device" the technical one, and both point at the reason such units exist - the functions share a print engine, a scanning bar and a paper path, so combining them costs far less than separate machines. The device is neither purely input nor purely output, since it performs both.

Please log in or register to report this question.

10.

Which are the input devices that enable direct data entry into a computer system from source documents?

Answer: A

Correct answer: Data Scanning devices

Data scanning devices read the source document itself, so the data never has to be transcribed - optical mark readers, optical character readers, bar code readers and magnetic ink character readers all belong to the class.

The gain is accuracy as much as speed: manual keying introduces errors at a rate that matters when the volume is large, and reading the original removes that step entirely. The other three options are not established categories.

Please log in or register to report this question.

Loading…
Tags: Input and Output Questions and Answers || Input and Output MCQ Questions and Answers || Input and Output GK Questions and Answers || Input and Output GK MCQ Questions || Input and Output Multiple Choice Questions and Answers || Input and Output GK || GK on Input and Output || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming