[go: up one dir, main page]

0% found this document useful (0 votes)
51 views6 pages

Quiz About C Loops & Control Structure

The document contains a series of programming questions related to C language loops and control structures, each with multiple-choice answers. It includes ten questions that test knowledge on topics such as switch statements, loops, and conditional statements. The document is designed for practice and discussion among users preparing for coding interviews or assessments.

Uploaded by

chandra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views6 pages

Quiz About C Loops & Control Structure

The document contains a series of programming questions related to C language loops and control structures, each with multiple-choice answers. It includes ten questions that test knowledge on topics such as switch statements, loops, and conditional statements. The document is designed for practice and discussion among users preparing for coding interviews or assessments.

Uploaded by

chandra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Tutorials

Search... Sign In
Practice
Jobs
DSA Practice Problems C C++ Java Python JavaScript Data Science Machine Learning Courses Linux DevOps SQL Web Develop

C Loops & Control Structure


Last Updated : Jan 19, 2024 Discuss

Question 1

#include <stdio.h>

int main()
{
int i = 1024;
for (; i; i >>= 1)
printf("GeeksQuiz");
return 0;
}

How many times will GeeksQuiz be printed in the above program?

A 10

B 11

C Infinite

D The program will show compile-time error

Discuss it

Question 2

#include <stdio.h>
#define PRINT(i, limit) do \\
{ \\
if (i++ < limit) \\
{ \\
printf("GeeksQuiz\\n"); \\
continue; \\
} \\
}while(0);

int main()
{
int i = 0;
PRINT(i, 3);
return 0;
}

How many times GeeksQuiz is printed in the above program ?

A
1

B
3

We
4
C use cookies to ensure you have the best browsing experience on our website. By using our site, you
Got It !
acknowledge that you have read and understood our Cookie Policy & Privacy Policy
D
Compile-time error

Discuss it

Question 3

What is the output of the below program?

#include <stdio.h>

int main() {
int i = 2;
switch (i) {
case 0:
printf("Geeks");
break;
case 1:
printf("Quiz");
break;
default:
printf("GeeksQuiz");
}
return 0;
}

A Geeks

B Quiz

C GeeksQuiz

D Compile-time error

Discuss it

Question 4

#include <stdio.h>

int main() {
int i = 3;
switch (i) {
case 1:
printf("Geeks");
break;
case 1+2:
printf("Quiz");
break;
default:
printf("GeeksQuiz");
}
return 0;
}

What is the output of the above program?

A Geeks

B Quiz
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
C GeeksQuiz
acknowledge that you have read and understood our Cookie Policy & Privacy Policy
D Compile-time error

Discuss it

Question 5

Predict the output of the below program:

#include <stdio.h>

#define EVEN 0
#define ODD 1

int main() {
int i = 3;
switch (i % 2) {
case EVEN:
printf("Even");
break;
case ODD:
printf("Odd");
break;
default:
printf("Default");
}
return 0;
}

A Even

B Odd

C Default

D Compile-time error

Discuss it

Question 6

#include <stdio.h>

int main() {
int i;
if (printf("0"))
i = 3;
else
i = 5;
printf("%d", i);
return 0;
}

Predict the output of above program?

A 3

B 5

C 03
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
D 05 acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Discuss it

Question 7

#include <stdio.h>

int i;

int main() {
if (i) {
// Do nothing
} else {
printf("Else");
}
return 0;
}

What is correct about the above program?

A if block is executed.

B else block is executed.

C It is unpredictable as i is not initialized.

D Error: misplaced else

Discuss it

Question 8

#include<stdio.h>
int main()
{
int n;
for (n = 9; n!=0; n--)
printf("n = %d", n--);
return 0;
}

What is the output?

A 97531

B 987654321

C Infinite Loop

D 9753

Discuss it

Question 9

We use cookies to ensure you have the best browsing experience on our website. By using our site, you
Output? acknowledge that you have read and understood our Cookie Policy & Privacy Policy
#include <stdio.h>
int main()
{
int c = 5, no = 10;
do {
no /= c;
} while(c--);

printf ("%d\\n", no);


return 0;
}

A 1

B Runtime Error

C 0

D Compiler Error

Discuss it

Question 10

# include <stdio.h>
int main()
{
int i = 0;
for (i=0; i<20; i++)
{
switch(i)
{
case 0:
i += 5;
case 1:
i += 2;
case 5:
i += 5;
default:
i += 4;
break;
}
printf("%d ", i);
}
return 0;
}

A 5 10 15 20

B 7 12 17 22

C 16 21

D Compiler Error

Discuss it

Tags: C Quiz
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our Cookie Policy & Privacy Policy
There are 45 questions to complete.

Take a part in the ongoing discussion View All Discussion

Company Explore Tutorials DSA Data Science & Web


About Us Job-A-Thon Python Data Structures ML Technologies
Corporate & Communications Legal Offline Java Algorithms Data Science With HTML
Address: Privacy Policy Classroom C++ DSA for Python CSS
Careers Program PHP Beginners
A-143, 7th Floor, Machine Learning JavaScript
Sovereign Corporate In Media DSA in GoLang Basic DSA ML Maths TypeScript
Tower, Sector- 136, Noida, Contact Us JAVA/C++ SQL Problems Data Visualisation ReactJS
Uttar Pradesh (201305) Corporate Master R Language DSA Roadmap Pandas NextJS
Solution System Android DSA Interview
Registered Address: NumPy NodeJs
Campus Design Questions
K 061, Tower K, Gulshan NLP Bootstrap
Training Master CP Competitive
Vivante Apartment, Sector Deep Learning Tailwind CSS
137, Noida, Gautam Buddh Program Videos Programming
Nagar, Uttar Pradesh,
201305 Python Computer DevOps System School Databases
Tutorial Science Git Design Subjects SQL

Python GATE CS AWS High Level Mathematics MYSQL

Examples Notes Docker Design Physics PostgreSQL


Django Operating Kubernetes Low Level Chemistry PL/SQL

Tutorial Systems Azure Design Biology MongoDB

Python Computer GCP UML Diagrams Social Science

Projects Network DevOps Interview Guide English Grammar


Advertise with us Python Database Roadmap Design Patterns
Tkinter Management OOAD
Web Scraping System System Design
OpenCV Software Bootcamp
Tutorial Engineering Interview
Python Digital Logic Questions
Interview Design

Question Engineering
Maths

Preparation More Courses Programming Clouds/Devops GATE 2026


IBM Languages DevOps GATE CS Rank
Corner Tutorials
Certification C Programming Engineering Booster
Company- Software
Courses with Data AWS Solutions GATE DA Rank
Wise Development
DSA and Structures Architect Booster
Recruitment Software
Placements C++ Certification GATE CS & IT
Process Testing
Web Programming Salesforce Course - 2026
Aptitude Product
Development Course Certified GATE DA
Preparation Management
Data Science Java Administrator Course 2026
Puzzles Project
Programming Programming Course GATE Rank
Company- Management
Languages Course Predictor
Wise Linux
DevOps & Python Full
Preparation Excel
Cloud Course
All Cheat
Sheets

@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved

We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our Cookie Policy & Privacy Policy

You might also like