SlideShare a Scribd company logo
C programs pbq final
1. What will be output when you will execute
following c code?
#include<stdio.h>
int main(){
printf("%dt",sizeof(6.5));
printf("%dt",sizeof(90000));
printf("%d",sizeof('A'));
return 0;
}
2.What will be output when you will execute following
c code?
#include<stdio.h>
int main(){
signed x;
unsigned y;
x = 10 +- 10u + 10u +- 10;
y = x;
if(x==y)
printf("%d %d",x,y);
else if(x!=y)
printf("%u %u",x,y);
return 0;
}
3.What will be output when you will execute
following c code?
#include<stdio.h>
int main(){
double num=5.2;
int var=5;
printf("%dt",sizeof(!num));
printf("%dt",sizeof(var=15/2));
printf("%d",var);
return 0;
}
4.What will be output when
you will execute following c code?
#include<stdio.h>
enum A{
x,y=5,
enum B{
p=10,q
}varp;
}varx;
int main(){
printf("%d%d",x,varp.q);
return 0;
}
C programs pbq final
6.What will be the output of the following.
#include<stdio.h>
#include<conio.h>
void main()
{
int a=1,b=1,c=0,i;
clrscr();
printf("%dt%dt",a,b);
for(i=0;i<=10;i++)
{
c=a+b;
if(c<100)
{
printf("%dt",c);
}
a=b;
b=c;
}
getch();
}
7.What will be the output of the following code.
#include<stdio.h>
#include<conio.h>
void main()
{
int uabs(int), x;
clrscr();
printf(“enter a negative value:”);
scanf(“%d”, x);
x=uabs(x);
printf(“X=%d”, x);
return 0;
}
uabs(int y)
{
if(y<0)
return(y*-1);
else
return(y);
}
8.What will be the content of 'file.c' after executing the
following program?
#include<stdio.h>
int main()
{
FILE *fp1, *fp2;
fp1=fopen("file.c", "w");
fp2=fopen("file.c", "w");
fputc('A', fp1);
fputc('B', fp2);
fclose(fp1);
fclose(fp2);
return 0; }
9.What is the output of the
following program?
void main()
{
static int i=i++, j=j++, k=k++;
printf(“i = %d j = %d k = %d”, i, j, k);
}
10.What is the output of the
following program?
main()
{
unsigned int i=10;
while(i-->=0)
printf(“%u ”,i);
}
11.What is the output of the
following program?
#include<conio.h>
main()
{
int x,y=2,z,a;
if(x=y%2) z=2;
a=2;
printf(“%d %d”,z,x);
}
12.What is the output of the
following program?
main()
{
int a[10];
printf(“%d”,*a+1-*a+3);
}
13. What is the output of the
following program?
#define prod(a,b) a*b
main()
{
int x=3,y=4;
printf(“%d”,prod(x+2,y-1));
}
14.What is the output of the
following program?
main()
{
unsigned int i=65000;
while(i++!=0);
printf("%d",i);
}
15. What is the output of the
following program?
main()
{
float f=5,g=10;
enum{i=10,j=20,k=50};
printf(“%dn”,++k);
printf(“%fn”,f<<2);
printf(“%lfn”,f%g);
printf(“%lfn”,fmod(f,g));
}
16. What is the output of the
following program?
main()
{
signed char i=0;
for(;i>=0;i++) ;
printf(“%dn”,i);
}
17. What is the output of the
following program?
main()
{
unsigned char i=0;
for(;i>=0;i++) ;
printf(“%dn”,i);
}
18.What is the output of the
following program?
main()
{
char *p = “ayqm”;
printf(“%c”,++*(p++));
}
C programs pbq final
20.What is the output of the
following program?
main()
{
char str1[] = {‘s’,‘o’,‘m’,‘e’};
char str2[] = {‘s’,‘o’,‘m’,‘e’,‘0’};
while (strcmp(str1,str2))
printf(“Strings are not equaln”);
}
21. What is the output of the
following program?
void main()
{
static int i;
while(i<=10)
(i>2)?i++:i--;
printf(“%d”, i);
}
22.What is the output of the
following program?
main()
{
register int a=2;
printf(“Address of a = %d”,&a);
printf(“Value of a = %d”,a);
}
23. What is the output of the
following program?
main()
{
float i=1.5;
switch(i)
{
case 1: printf(“1”);
case 2: printf(“2”);
default : printf(“0”);
}
}
24.What is the output of the
following program?
main()
{
extern i;
printf(“%dn”,i);
{
int i=20;
printf(“%dn”,i);
}
}
25.What is the output of the
following program?
main()
{
int i = 257;
int *iPtr = &i;
printf(“%d %d”, *((char*)iPtr), *((char*)iPtr+1));
}
26. What is the output of the
following program?
main()
{
char a[4]=“HELLO”;
printf(“%s”,a);
}
27.What is the output of the
following program?
void main()
{
int const * p=5;
printf("%d",++(*p));
}
28.What is the output of the
following program?
main()
{
char s[ ]=“man”;
int i;
for(i=0;s[ i ];i++)
printf(“n%c%c%c%c”,s[ i ],*(s+i),*(i+s),i[s]);
}
29.What is the output of the
following program?
main()
{
char *p;
printf(“%d %d ”,sizeof(*p),sizeof(p));
}
30. What is the output of the
following program?
#define int char
main()
{
int i=65;
printf(“sizeof(i)=%d”,sizeof(i));
}

More Related Content

PDF
Prime number program in c
DOCX
Runge kutta C programme
PDF
Progr2
DOCX
1 (1)
DOCX
C Language Programs
DOC
Add digits of number in c
PPTX
Program presentation
Prime number program in c
Runge kutta C programme
Progr2
1 (1)
C Language Programs
Add digits of number in c
Program presentation

What's hot (14)

PPTX
Logic development
PPTX
Pointer example
PDF
C Programming Example
PPTX
C Programming Example
PDF
Program in ‘C’ language to implement linear search using pointers
DOC
C program to add n numbers
PDF
Bcsl 033 data and file structures lab s2-2
PDF
C언어 스터디 강의자료 - 1차시
PDF
Dfs implementation in c
Logic development
Pointer example
C Programming Example
C Programming Example
Program in ‘C’ language to implement linear search using pointers
C program to add n numbers
Bcsl 033 data and file structures lab s2-2
C언어 스터디 강의자료 - 1차시
Dfs implementation in c
Ad

Viewers also liked (8)

PDF
Www.winthefightagainstcancernaturally
PPTX
Multi media presentation k kietzerow
PDF
Lavori alla Grotta 26/01/14
PPTX
Www.winthefightagainstcancernaturally.org
PPT
Cathoderaytube
PPTX
Rmi presentation
PPT
PPT
Uml manuu lab BY SARFARAZ HUSAIN
Www.winthefightagainstcancernaturally
Multi media presentation k kietzerow
Lavori alla Grotta 26/01/14
Www.winthefightagainstcancernaturally.org
Cathoderaytube
Rmi presentation
Uml manuu lab BY SARFARAZ HUSAIN
Ad

Similar to C programs pbq final (20)

PPT
operators in c language programming to improve c skills
PPT
lets play with "c"..!!! :):)
DOC
C basics
DOCX
Qust & ans inc
DOCX
Best C Programming Solution
PDF
C lab programs
PDF
C lab programs
PDF
C++ Programming - 1st Study
PDF
LET US C (5th EDITION) CHAPTER 2 ANSWERS
DOCX
C Programming
DOCX
DOC
'C' language notes (a.p)
PDF
Common problems solving using c
DOCX
DOCX
B.Com 1year Lab programs
DOCX
Program flowchart
DOCX
Core programming in c
PDF
9.C Programming
PDF
C questions
operators in c language programming to improve c skills
lets play with "c"..!!! :):)
C basics
Qust & ans inc
Best C Programming Solution
C lab programs
C lab programs
C++ Programming - 1st Study
LET US C (5th EDITION) CHAPTER 2 ANSWERS
C Programming
'C' language notes (a.p)
Common problems solving using c
B.Com 1year Lab programs
Program flowchart
Core programming in c
9.C Programming
C questions

More from Azad public school (9)

PDF
software engineering
PPT
PDF
Computer science-view notices
PPT
2. data warehouse 2nd unit
PPT
3. mining frequent patterns
PPT
3.1 mining frequent patterns with association rules-mca4
PPT
2. olap warehouse
PPT
2. visualization in data mining
software engineering
Computer science-view notices
2. data warehouse 2nd unit
3. mining frequent patterns
3.1 mining frequent patterns with association rules-mca4
2. olap warehouse
2. visualization in data mining

Recently uploaded (20)

PPTX
GDM (1) (1).pptx small presentation for students
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
01-Introduction-to-Information-Management.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Institutional Correction lecture only . . .
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
Pre independence Education in Inndia.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
GDM (1) (1).pptx small presentation for students
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Insiders guide to clinical Medicine.pdf
Supply Chain Operations Speaking Notes -ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Sports Quiz easy sports quiz sports quiz
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Microbial diseases, their pathogenesis and prophylaxis
01-Introduction-to-Information-Management.pdf
Anesthesia in Laparoscopic Surgery in India
102 student loan defaulters named and shamed – Is someone you know on the list?
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Institutional Correction lecture only . . .
human mycosis Human fungal infections are called human mycosis..pptx
Cell Structure & Organelles in detailed.
Pre independence Education in Inndia.pdf
Cell Types and Its function , kingdom of life
PPH.pptx obstetrics and gynecology in nursing
Chapter 2 Heredity, Prenatal Development, and Birth.pdf

C programs pbq final

  • 2. 1. What will be output when you will execute following c code? #include<stdio.h> int main(){ printf("%dt",sizeof(6.5)); printf("%dt",sizeof(90000)); printf("%d",sizeof('A')); return 0; }
  • 3. 2.What will be output when you will execute following c code? #include<stdio.h> int main(){ signed x; unsigned y; x = 10 +- 10u + 10u +- 10; y = x; if(x==y) printf("%d %d",x,y); else if(x!=y) printf("%u %u",x,y); return 0; }
  • 4. 3.What will be output when you will execute following c code? #include<stdio.h> int main(){ double num=5.2; int var=5; printf("%dt",sizeof(!num)); printf("%dt",sizeof(var=15/2)); printf("%d",var); return 0; }
  • 5. 4.What will be output when you will execute following c code? #include<stdio.h> enum A{ x,y=5, enum B{ p=10,q }varp; }varx; int main(){ printf("%d%d",x,varp.q); return 0; }
  • 7. 6.What will be the output of the following. #include<stdio.h> #include<conio.h> void main() { int a=1,b=1,c=0,i; clrscr(); printf("%dt%dt",a,b); for(i=0;i<=10;i++) { c=a+b; if(c<100) { printf("%dt",c); } a=b; b=c; } getch(); }
  • 8. 7.What will be the output of the following code. #include<stdio.h> #include<conio.h> void main() { int uabs(int), x; clrscr(); printf(“enter a negative value:”); scanf(“%d”, x); x=uabs(x); printf(“X=%d”, x); return 0; } uabs(int y) { if(y<0) return(y*-1); else return(y); }
  • 9. 8.What will be the content of 'file.c' after executing the following program? #include<stdio.h> int main() { FILE *fp1, *fp2; fp1=fopen("file.c", "w"); fp2=fopen("file.c", "w"); fputc('A', fp1); fputc('B', fp2); fclose(fp1); fclose(fp2); return 0; }
  • 10. 9.What is the output of the following program? void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, j, k); }
  • 11. 10.What is the output of the following program? main() { unsigned int i=10; while(i-->=0) printf(“%u ”,i); }
  • 12. 11.What is the output of the following program? #include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf(“%d %d”,z,x); }
  • 13. 12.What is the output of the following program? main() { int a[10]; printf(“%d”,*a+1-*a+3); }
  • 14. 13. What is the output of the following program? #define prod(a,b) a*b main() { int x=3,y=4; printf(“%d”,prod(x+2,y-1)); }
  • 15. 14.What is the output of the following program? main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }
  • 16. 15. What is the output of the following program? main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf(“%dn”,++k); printf(“%fn”,f<<2); printf(“%lfn”,f%g); printf(“%lfn”,fmod(f,g)); }
  • 17. 16. What is the output of the following program? main() { signed char i=0; for(;i>=0;i++) ; printf(“%dn”,i); }
  • 18. 17. What is the output of the following program? main() { unsigned char i=0; for(;i>=0;i++) ; printf(“%dn”,i); }
  • 19. 18.What is the output of the following program? main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }
  • 21. 20.What is the output of the following program? main() { char str1[] = {‘s’,‘o’,‘m’,‘e’}; char str2[] = {‘s’,‘o’,‘m’,‘e’,‘0’}; while (strcmp(str1,str2)) printf(“Strings are not equaln”); }
  • 22. 21. What is the output of the following program? void main() { static int i; while(i<=10) (i>2)?i++:i--; printf(“%d”, i); }
  • 23. 22.What is the output of the following program? main() { register int a=2; printf(“Address of a = %d”,&a); printf(“Value of a = %d”,a); }
  • 24. 23. What is the output of the following program? main() { float i=1.5; switch(i) { case 1: printf(“1”); case 2: printf(“2”); default : printf(“0”); } }
  • 25. 24.What is the output of the following program? main() { extern i; printf(“%dn”,i); { int i=20; printf(“%dn”,i); } }
  • 26. 25.What is the output of the following program? main() { int i = 257; int *iPtr = &i; printf(“%d %d”, *((char*)iPtr), *((char*)iPtr+1)); }
  • 27. 26. What is the output of the following program? main() { char a[4]=“HELLO”; printf(“%s”,a); }
  • 28. 27.What is the output of the following program? void main() { int const * p=5; printf("%d",++(*p)); }
  • 29. 28.What is the output of the following program? main() { char s[ ]=“man”; int i; for(i=0;s[ i ];i++) printf(“n%c%c%c%c”,s[ i ],*(s+i),*(i+s),i[s]); }
  • 30. 29.What is the output of the following program? main() { char *p; printf(“%d %d ”,sizeof(*p),sizeof(p)); }
  • 31. 30. What is the output of the following program? #define int char main() { int i=65; printf(“sizeof(i)=%d”,sizeof(i)); }