Log In Register

Units


Formatted Input - Questions and Answers

 

Practice these Formatted Input  under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Formatted Input for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Formatted Input of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Formatted Input .
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Formatted Input under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Formatted Input topic of C Programming:

 

1.

Which of the following doesn’t require an & for the input in scanf?

Answer: Option C

Explanation:

2.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char n[] = "hellonworld!";
  5.         char s[13];
  6.         sscanf(n, "%s", s);
  7.         printf("%s\n", s);
  8.         return 0;
  9.     }

Answer: Option B

Explanation:

3.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int n;
  5.         scanf("%d", n);
  6.         printf("%d", n);
  7.     }

Answer: Option B

Explanation:

4.

Which of the following is NOT a delimiter for an input in scanf?

Answer: Option D

Explanation:

5.

What is the output of this C code (when 4 and 5 are entered)?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int m, n;
  5.         printf("enter a number");
  6.         scanf("%d", &n);
  7.         scanf("%d", &m);
  8.         printf("%d\t%d\n", n, m);
  9.     }

Answer: Option A

Explanation:

6.

Which of the following is an invalid method for input?

Answer: Option D

Explanation:

7.

int sscanf(char *string, char *format, arg1, arg2, …)

Answer: Option A

Explanation:

8.

scanf returns as its value

Answer: Option D

Explanation:

9.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         short int i;
  5.         scanf("%hd", &i);
  6.         printf("%hd", i);
  7.         return 0;
  8.     }

Answer: Option A

Explanation:

10.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char *n;
  5.         scanf("%s", n);
  6.         return 0;
  7.     }

Answer: Option A

Explanation:

11.

The conversion characters d, i, o, u, and x may be preceded by h in scanf to indicate

Answer: Option D

Explanation:

12.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         short int i;
  5.         scanf("%*hd", &i);
  6.         printf("%hd", i);
  7.         return 0;
  8.     }

Answer: Option D

Explanation:

13.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int n;
  5.         scanf("%d", n);
  6.         printf("%d\n", n);
  7.         return 0;
  8.     }

Answer: Option C

Explanation:

14.

Which of the following represents the function for scanf?

Answer: Option C

Explanation:

15.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         short int i;
  5.         scanf("%*d", &i);
  6.         printf("%hd", i);
  7.         return 0;
  8.     }

Answer: Option C

Explanation: