0% found this document useful (0 votes)
15 views

Week 1 Questions

Uploaded by

04vh7153b0
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)
15 views

Week 1 Questions

Uploaded by

04vh7153b0
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/ 5

Week 1 Questions

Sr. Question Options


no.

1 Find the output: A. 10


#include<stdio.h>int main() B. 20
{ C. 21
D. 11
int x=10; int y;
{
y=x++;
}
printf("%d",x);
}

2 Find the output: A. 97


#include<stdio.h> B. 98
int main() C. 99
{ D. ‘a’
char c='a';
switch(c){
case 97:
printf("97");
break;
case 98:
printf("98");
break;
case 99:
printf("99");
break;
default:
printf("default");

}
}
3 Find the output: A. 1,10
#include<stdio.h>int B. 9,11
main() C. 9,19
{ D. 1,19
int x=10;
int a=1,b=2,c=3,d=4;
x+=a=b*c+d-a;
printf("%d,%d",a,x);
}

4 Find the output: A. YES


#include<stdio.h>int B. NO
main() C. Error
{
float a=1.1;int
b=1.1; if(a==b)
printf("YES");
else
printf("NO");
}

5 Find the output: I. 11


#include<stdio.h>int II. 13
III. 15
main()
IV. 17
{
int i,x=10;
for(i=0;i<2;i++);
{
x++;
}
printf("%d",x);
}
6 Find the output: i. 13
#include<stdio.h> ii. 15
iii. 17
int main()
iv. 19
{
int i=-10;
if(i){
printf("1");
}
i=0;
if(i){
printf("2");
}
i=5;
if(i){
printf("3");
}
}

7 Find the output: A. 10


#include<stdio.h> B. 11
int main() C. 12
{ D. 13
int x=10; E. The program runs for
do{ more than 10 iterations.
x++;
}while(x++>12);
printf("%d",x);
}

9 Find the output: A. 2


void main(){ B. 3
int a=22; C. 1
a=a>>4; D. 5
printf("%d",a);
}

10 Find the output: A. 7


void main(){ B. 8
int a,b; C. 6
a=3,1; D. Error

b=(5,4);
printf("%d",a+b);
}
11 Which of the following condition A. a==10
checks will print 10 twice? B. a <= 10
C. printf("\n
void main(){ %d",a)
int a=10; D. None of theabove
if( )
printf("\n%d",a);
else
printf("\n%d %d",a,a);
}
12 #include<stdio.h> i. 9
ii. 11
main ( ) iii. 13
{ iv. 15
int a=5;
int b = a % ( a−a /2 ) ∗ ( a
—3)+a;
printf(”%d”,b);
return 0 ;
}
14 #include<stdio.h> a. 1
b. 2
int main(){ c. 4
int i=1; d. 7
i += i*i>>2+3;
printf("%d",i);
return 0;
}
Give the result of compiling and
running the above program?
15 #include<stdio.h> a. 15
b. 24
int main(){ c. 33
int i=1; d. 34
i += i*i<<2+3;
printf("%d",i);
return 0;
}
Give the result of compiling and
running the above program?

16 char a,b,c; a. AABbCc


a = 'b'; b. AABbCc
b = 'c'; c. AABACA
c = 'A'; d. AcBbCA
b=c;c=b;
a=c;c=a;
printf("A%cB%cC%c",a,b,c);
What will be the output printed
by the printf statement?

Programming Question #1

Write a program to find the number of perfect squares between given two numbers A and B
(both inclusive). A number is called a perfect square if it can be written as x*x for some integer x.

Programming Question #2

Write a program to find whether a given number (say x) is a “perfect number” or not.

Programming Qn #3
Write a C program that takes a positive number N and produces an output that is the product of
its digits.

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