0% found this document useful (0 votes)
100 views3 pages

Unit 2 Questions Theory and Objective Questions

The document discusses various programming concepts in C including iterative statements, selection statements, loops, functions to find GCD, LCM, palindrome numbers, and more. It also includes questions about the output of code snippets using if/else statements, switch cases, while loops, and more.

Uploaded by

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

Unit 2 Questions Theory and Objective Questions

The document discusses various programming concepts in C including iterative statements, selection statements, loops, functions to find GCD, LCM, palindrome numbers, and more. It also includes questions about the output of code snippets using if/else statements, switch cases, while loops, and more.

Uploaded by

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

1. Discuss about various types of iterative statements with an appropriate example.

2. Discuss multiway selection statements with proper example.


3. Write a c program to select and find area of a circle , triangle and square .
4. Differentiate between event control and counter control loop with an example.
5. Differentiate between entry control and exit control loops with an example.
6. Write a program to find a number is palindrome or not. (1221 and reverse are same).
7. Write a C program to find GCD and LCM of 2 given number.
8. Write a program to read n>5 and display the numbers till 5.
9. Write a program to read n>5 and display the numbers 1 to n except 3 .
Output: 1,2,4,5,6. If n=6

Objective
1. Rewrite the following code using one if statement.____________________________
If(achar==’E’)
C++;
If(achar==’E’)
Printf(“ the value is E\n”);
2. The value that follows the keyword CASE may only be_________________
3. The statement which is used to terminate the control from the loop is_____________

4________________is the output of the following code


#include<stdio.h>
void main()
{
int a = 2;
switch(a)
{
case 1:
printf("goodbye"); break;
case 2:
continue;
case 3:
printf("bye");
}

5. ________________is the output of the following code


#include<stdio.h>

void main()
{
if(printf("cquestionbank"))
printf("I know c");
else
printf("I know c++");
}
6. ________________is the output of the following code
#include<stdio.h>

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

7.________________is the output of the following code


#include<stdio.h>
void main()
{
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{
printf("EXAM");
}
}
8.________________is the output of the following code
#include<stdio.h>
void main()
{
int s=0;
while(s++<10)
{
if(s<4 && s<9)
continue;
printf("\n%d\t",s);
}
}

9. The loop in which the statements within the loop are executed at least once is called____-___
10. Which keyword is used to come out of a loop only for that iteration is__________________?
11. ____________is The output of the code below is

#include <stdio.h>
int x;
void main()
{
if (x)
printf("hi");
else
printf("how are u");
}
12. Comment on the following code below___________________

#include <stdio.h>
void main()
{
int x = 5;
if (true);
printf("hello");
}
13. The output of the code below is______________________

#include <stdio.h>
void main()
{
int x = 0;
if (x == 0)
printf("hi");
else
printf("how are u");
printf("hello");
}
14. The output of the code below is_________________

#include <stdio.h>
void main()
{
int x = 5;
if (x < 1);
printf("Hello");

}
15. The output of the code below is_________________
#include <stdio.h>
int main()
{
int i = 3;
switch (i)
{
case 0+1: printf("Geeks");
break;
case 1+2: printf("Quiz");
break;
default: printf("GeeksQuiz");
}
return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy