You are on page 1of 9

Home Branchwise MCQs  Test & Rank  Contests Internship Training 

1000 C MCQs
C Programming
Questions and
Answers –
Formatted
Input – 1
« Prev Next »

Data Types, Operators This section on C test


& Expressions in C focuses on “Formatted
Input”. One shall practice Part Time Internships @ Home
Control Flow these test questions to
1-Day Campus Ambassador
Statements in C improve their C
programming skills Content Developer
C Functions & Program needed for various
Structure interviews (campus Content Writer
interviews, walkin Programmer
Pointers & Arrays in C
interviews, company
interviews), placements, Digital Marketer
Structures, Unions &
entrance exams and other
Bit-Fields in C
competitive exams. These
Input & Output in C questions can be
attempted by anyone
Floating Point & Sizeof focusing on learning C
Operator in C Programming language.
They can be a beginner,
Enumerations & fresher, engineering
Typedefs in C graduate or an
experienced IT
String Operations in C professional. Our C test
questions come with
C Library
detailed explanation of the
answers which helps in
Dynamic Memory
better understanding of C
Allocation in C
concepts.
C Preprocessor
Miscellaneous Topics in Here is a listing of C test
C questions on “Formatted
Input” along with answers,
Best Reference Books explanations and/or
solutions:

1. What will be the output


of the following C code?

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

a) Compilation error
b) Unde ned behavior
c) Whatever user types
d) Depends on the
standard

View Answer

2. What will be the output


of the following C code?

1. #include <stdio.h> Evergreen Careers


2. int main()
Developer Tracks
3. {
4. char *n;
Linux Kernel Developer
5. scanf("%s", n)
Exercises & Tests 6. return 0; Linux Driver Developer
7. }
C Programming Tests Linux Network Developer
a) Compilation error
Certi cation Test b) Unde ned behavior SAN Developer
c) Nothing
Internship Test
d) None of the mentioned
Job Test
View Answer
Quali er Test
3. What will be the output
Top Rankers
of the following C code?
Practice Test - Chapter 1 1. #include <stdio.h>
2. int main()
Practice Test - Chapter 2 3. {
4. char n[] = "he
Practice Test - Chapter 3 5. char s[13];
6. sscanf(n, "%s"
Practice Test - Chapter 4
7. printf("%s\n"

Practice Test - Chapter 5 8. return 0;


9. }
Practice Test - Chapter 6
a) hellonworld!
Practice Test - Chapter 7 b)

Practice Test - Chapter 8

Practice Test - Chapter 9 hello


world!
Practice Test - Chapter 10

Mock Test - Chapter 1 c) hello


Mock Test - Chapter 2 d) hello world!

View Answer
Mock Test - Chapter 3

Mock Test - Chapter 4 4. What will be the output


of the following C code?
Mock Test - Chapter 5

Mock Test - Chapter 6 1. #include <stdio.h>


2. int main()
Mock Test - Chapter 7 3. {
4. short int i;
Mock Test - Chapter 8
5. scanf("%hd", &
6. printf("%hd",
Mock Test - Chapter 9
7. return 0;
Mock Test - Chapter 10 8. }

a) Compilation error
b) Unde ned behavior
c) Whatever user types
d) None of the mentioned

View Answer

5. What will be the output


of the following C code?

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

a) Compilation error
b) Somegarbage value
c) Whatever user types
d) Depends on the
standard

View Answer

6. What will be the output


of the following C code?

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

a) Compilation error
b) Somegarbage value
c) Whatever user types
d) Depends on the
standard

View Answer

7. What will be the output


of the following C code?

1. #include <stdio.h>
2. int main()
3. {
4. short int i;
5. scanf("%h*d",
6. printf("%hd",
7. return 0;
8. }
a) Compilation error
b) Unde ned behavior
c) Somegarbage value
d) Depends on the
standard.

View Answer

8. Which of the following is


NOT a delimiter for an
input in scanf?
a) Enter
b) Space
c) Tab
d) None of the mentioned

View Answer

9. If the conversion
characters of int d, i, o, u
and x are preceded by h, it
indicates?
a) A pointer to int
b) A pointer to short
c) A pointer to long
d) A pointer to char

View Answer

Sanfoundry Global
Education & Learning
Series – C Programming
Language.

C Practice Resources
C Mock Tests &
Certi cation Test | 1000
C MCQs | 1000 C
Programs | 1000 C
Algorithms | Best C
Books | C Internship

Participate in the
Sanfoundry Certi cation
contest to get free
Certi cate of Merit. Join
our social networks below
and stay updated with
latest contests, videos,
internships and jobs!

Youtube | LinkedIn |
Instagram | Facebook |
Twitter | Pinterest

« Prev - C Programming
Questions and Answers –
Variable Length Argument
–2
» Next - C Programming
Questions and Answers –
Formatted Input – 2

advertisement

Recommended
Posts:
1. C Programming
Examples on
Numerical
Problems &
Algorithms
2. C Programming
Examples on
Strings
3. C Programming
Examples on Matrix
4. C Programming
Examples on
Bitwise Operations
5. Python
Programming
Examples
6. C++ Programming
Examples on Set &
String Problems &
Algorithms
7. Java Programming
Examples
8. C Programming
Examples without
using Recursion
9. C Programming
Examples on Set &
String Problems &
Algorithms
10. PLC Programming
Examples
11. C# Programming
Examples on
Networking
12. Java Programming
Examples on
Java.Lang
13. C Programming
Examples
14. C# Programming
Examples
15. C Algorithms,
Problems &
Programming
Examples
16. Java Algorithms,
Problems &
Programming
Examples
17. C++ Algorithms,
Problems &
Programming
Examples
18. C# Programming
Examples on Matrix
19. C Questions and
Answers
20. Java Programming
Examples on
Classes

Leave a Comment

Name *

Email *

Website

Post Comment

Ma
nish
Bho
jasi
a, a
tec
hno
logy veteran with 20+
years @ Cisco & Wipro, is
Founder and CTO at
Sanfoundry. He is Linux
Kernel Developer & SAN
Architect and is passionate
about competency
developments in these
areas. He lives in
Bangalore and delivers
focused training sessions
to IT professionals in Linux
Kernel, Linux Debugging,
Linux Device Drivers, Linux
Networking, Linux Storage,
Advanced C Programming,
SAN Storage Technologies,
SCSI Internals & Storage
Protocols such as iSCSI &
Fiber Channel. Stay
connected with him @
LinkedIn

Subscribe Sanfoundry
Newsletter and Posts

Name*

Email*

Subscribe

About | Certi cations | Internships | Jobs | Privacy Policy | Terms | Copyright | Contact

     

© 2011-2020 Sanfoundry. All Rights Reserved.

You might also like