logo
  • Home
  • About
  • Training
  • Programming
  • CS
  • IT
  • IS
  • ECE
  • EEE
  • EE
  • Civil
  • Mechanical
  • Chemical
  • Metallurgy
  • Instrumentation
  • Aeronautical
  • Aerospace
  • Biotechnology
  • Agriculture
  • MCA
  • BCA
  • Internship
  • Contact

C Multiple Choice Questions | MCQs | Quiz

C Programming Interview Questions and Answers
Pratice C Programming questions and answers for interviews, campus placements, online tests, aptitude tests, quizzes and competitive exams.

Get Started

•   Variable Names - 1
•   Variable Names - 2
•   Data Types
•   Data Sizes
•   Constants - 1
•   Constants - 2
•   Declarations - 1
•   Declarations - 2
•   Arithmetic Operators - 1
•   Arithmetic Operators - 2
•   Relational Operators
•   Logical Operators
•   Type Conversions - 1
•   Type Conversions - 2
•   Increment Operators
•   Decrement Operators
•   Bitwise Operators - 1
•   Bitwise Operators - 2
•   Assigment Operators
•   Expressions
•   Conditional Expressions - 1
•   Conditional Expressions - 2
•   Operator Precedence - 1
•   Operator Precedence - 2
•   Order of Evaluation - 1
•   Order of Evaluation - 2
•   Associativity - 1
•   Associativity - 2
•   If Statements - 1
•   If Statements - 2
•   Switch Statements - 1
•   Switch Statements - 2
•   For Loops - 1
•   For Loops - 2
•   While Loops - 1
•   While Loops - 2
•   Break & Continue - 1
•   Break & Continue - 2
•   Goto & Labels - 1
•   Goto & Labels - 2
•   Functions Basics - 1
•   Function Basics - 2
•   Functions Return
•   Return Values
•   External Variables - 1
•   External Variables - 2
•   Variable Scope - 1
•   Variable Scope - 2
•   Static Variables - 1
•   Static Variables - 2
•   Register Variables - 1
•   Register Variables - 2
•   Automatic Variables - 1
•   Automatic Variables - 2
•   Preprocessor - 1
•   Preprocessor - 2
•   File Inclusion - 1
•   File Inclusion - 2
•   Macro Substitution - 1
•   Macro Substitution - 2
•   Conditional Inclusion - 1
•   Conditional Inclusion - 2
•   Pointers & Addresses - 1
•   Pointers & Addresses - 2
•   Function Arguments - 1
•   Pointers Arguments 2
•   Pointers & Arrays - 1
•   Pointers & Arrays - 2
•   Address Arithmetic - 1
•   Address Arithmetic - 2
•   Pointers/Functions - 1
•   Pointers/Functions - 2
•   Pointers to Pointers - 1
•   Pointers to Pointers - 2
•   Multidimensional Arrays - 1
•   Multidimensional Arrays - 2
•   Pointer Arrays Init - 1
•   Pointer Arrays Init - 2
•   Multi-dimensional Arrays - 1
•   Multi-dimensional Arrays - 2
•   Command Line Arguments1
•   Command Line Arguments2
•   Pointers to Functions - 1
•   Pointers to Functions - 2
•   Complicated Declarations-1
•   Complicated Declarations-2
•   Structures - 1
•   Structures - 2
•   Structures & Functions - 1
•   Structures & Functions - 2
•   Arrays of Structures - 1
•   Arrays of Structures - 2
•   Pointer to Structures - 1
•   Pointer to Structures - 2
•   Self-Referential Structures-1
•   Self-Referential Structures-2
•   Table Lookup - 1
•   Table Lookup - 2
•   Typedefs - 1
•   Typedefs - 2
•   Unions - 1
•   Unions - 2
•   Bit-fields - 1
•   Bit-fields - 2
•   Standard Input & Output - 1
•   Standard Input & Output - 2
•   Printf - 1
•   Printf - 2
•   Varargs - 1
•   Varargs - 2
•   Scanf - 1
•   Scanf - 2
•   File Access - 1
•   File Access - 2
•   Error Handling - 1
•   Error Handling - 2
•   Line Input & Output - 1
•   Line Input & Output - 2
•   String Operations - 1
•   String Operations - 2
•   Character Class - 1
•   Character Class - 2
•   Ungetc - 1
•   Ungetc - 2
•   Storage Management - 1
•   Storage Management - 2
•   Mathematical Functions - 1
•   Mathematical Functions - 2
•   Random Number - 1
•   Random Number - 2
•   Float Datatype - 1
•   Float Datatype - 2
•   Sizeof - 1
•   Sizeof - 2

Best Reference Books

C Programming Books
« Prev Page
Next Page »

C Programming Questions and Answers – While Loops – 1

Posted on February 2, 2013 by Manish
This section on online C test focuses on “While Loops”. One shall practice these test questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our online C test questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of online C test questions on “While Loops” along with answers, explanations and/or solutions:

1. What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         while ()
  5.             printf("In while loop ");
  6.         printf("After loop\n");
  7.     }

a) In while loop after loop
b) After loop
c) Compile time error
d) Infinite loop
View Answer

Answer: c
Explanation: None.

2. What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         do
  5.             printf("In while loop ");
  6.         while (0);
  7.             printf("After loop\n");
  8.     }

a) In while loop
b) In while loop
after loop
c) After loop
d) Infinite loop
View Answer

Answer: b
Explanation: None.

3. What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int i = 0;
  5.         do {
  6.             i++;
  7.             printf("In while loop\n");
  8.         } while (i < 3);
  9.     }

a) In while loop
In while loop
In while loop
b) In while loop
In while loop
c) Depends on the compiler
d) Compile time error
View Answer

Answer: a
Explanation: None.

4. How many times i value is checked in the below code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int i = 0;
  5.         do {
  6.             i++;
  7.             printf("in while loop\n");
  8.         } while (i < 3);
  9.     }

a) 2
b) 3
c) 4
d) 1
View Answer

Answer: b
Explanation: None.

5. How many times i value is checked in the below code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int i = 0;
  5.         while (i < 3)
  6.             i++;
  7.         printf("In while loop\n");
  8.     }

a) 2
b) 3
c) 4
d) 1
View Answer

Answer: c
Explanation: None.

6. What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int i = 2;
  5.         do
  6.         {
  7.             printf("Hi");
  8.         } while (i < 2)
  9.     }

a) Compile time error
b) Hi Hi
c) Hi
d) Varies
View Answer

Answer: a
Explanation: None.

7. What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int i = 0;
  5.         while (++i)
  6.         {
  7.             printf("H");
  8.         }
  9.     }

a) H
b) H is printed infinite times
c) Compile time error
d) Varies
View Answer

Answer: b
Explanation: None.

8. What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         int i = 0;
  5.         do
  6.         {
  7.             printf("Hello");
  8.         } while (i != 0);
  9.     }

a) Nothing
b) H is printed infinite times
c) Hello
d) Run time error
View Answer

Answer: c
Explanation: None.

Sanfoundry Global Education & Learning Series – C Programming Language.

Here’s the list of Best Reference Books in C Programming Language.

To practice all features of C programming language, here is complete set of 1000+ Multiple Choice Questions and Answers on C.

« Prev Page - C Programming Questions and Answers – For Loops – 2
» Next Page - C Programming Questions and Answers – While Loops – 2
« C Programming Questions and Answers – For Loops – 2
C Programming Questions and Answers – While Loops – 2 »

Deep Dive @ Sanfoundry:

  1. C# Programming Examples
  2. C# Basic Programming Examples
  3. C# Programming Examples on LINQ
  4. C# Programming Examples on Networking
  5. C Questions and Answers
  6. Java Algorithms, Problems & Programming Examples
  7. C Algorithms, Problems & Programming Examples
  8. C++ Algorithms, Problems & Programming Examples
  9. Ruby Programming Questions and Answers
  10. R Programming Questions and Answers
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer and 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 & Cluster Administration, Advanced C Programming, SAN Storage Technologies, SCSI Internals and Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him below:
LinkedIn | Facebook | Twitter | Google+

Best Careers

Developer Tracks
SAN Developer
Linux Kernel Developer
Linux Driver Developer
Linux Network Developer

Live Training Photos
Mentoring
Software Productivity
GDB Assignment
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of almost all Top Companies in India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec, Redhat, Chelsio, Cavium, ST-Micro, Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Mphasis, Tata-Elxsi, Tata VSNL, Mindtree, Cognizant and Startups.

Best Trainings

SAN I - Technology
SAN II - Admin
Linux Fundamentals
Advanced C Training
Linux-C Debugging
System Programming
Network Programming
Linux Threads
Kernel Programming
Kernel Debugging
Linux Device Drivers

Best Reference Books

Computer Science Books
Algorithm & Programming Books
Electronics Engineering Books
Electrical Engineering Books
Chemical Engineering Books
Civil Engineering Books
Mechanical Engineering Books
Industrial Engineering Books
Instrumentation Engg Books
Metallurgical Engineering Books
All Stream Best Books

Questions and Answers

1000 C Questions & Answers
1000 C++ Questions & Answers
1000 C# Questions & Answers
1000 Java Questions & Answers
1000 Linux Questions & Answers
1000 Python Questions
1000 PHP Questions & Answers
1000 Hadoop Questions
Cloud Computing Questions
Computer Science Questions
All Stream Questions & Answers

India Internships

Computer Science Internships
Instrumentation Internships
Electronics Internships
Electrical Internships
Mechanical Internships
Industrial Internships
Systems Internships
Chemical Internships
Civil Internships
IT Internships
All Stream Internships

About Sanfoundry

About Us
Copyright
TOS & Privacy
Jobs
Bangalore Training
Online Training
SAN Training
Developers Track
Mentoring Sessions
Contact Us
Sitemap
© 2011 Sanfoundry