SlideShare a Scribd company logo
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;
}
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++));
}
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

What's hot

Logic development
Logic developmentLogic development
Logic development
Jerin John
 
Pointer example
Pointer examplePointer example
Pointer example
University of Potsdam
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
PRATHAMESH DESHPANDE
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
University of Potsdam
 
Program in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointersProgram in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointers
Dr. Loganathan R
 
C program to add n numbers
C program to add n numbers C program to add n numbers
C program to add n numbers
mohdshanu
 
Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2
Dr. Loganathan R
 
C언어 스터디 강의자료 - 1차시
C언어 스터디 강의자료 - 1차시C언어 스터디 강의자료 - 1차시
C언어 스터디 강의자료 - 1차시
Junha Jang
 
Dfs implementation in c
Dfs implementation in cDfs implementation in c
Dfs implementation in c
HapPy SumOn
 

What's hot (14)

Logic development
Logic developmentLogic development
Logic development
 
Factorial
FactorialFactorial
Factorial
 
Pointer example
Pointer examplePointer example
Pointer example
 
week-10x
week-10xweek-10x
week-10x
 
week-18x
week-18xweek-18x
week-18x
 
week-1x
week-1xweek-1x
week-1x
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
Vcs17
Vcs17Vcs17
Vcs17
 
Program in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointersProgram in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointers
 
C program to add n numbers
C program to add n numbers C program to add n numbers
C program to add n numbers
 
Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2
 
C언어 스터디 강의자료 - 1차시
C언어 스터디 강의자료 - 1차시C언어 스터디 강의자료 - 1차시
C언어 스터디 강의자료 - 1차시
 
Dfs implementation in c
Dfs implementation in cDfs implementation in c
Dfs implementation in c
 

Viewers also liked

Www.winthefightagainstcancernaturally
Www.winthefightagainstcancernaturallyWww.winthefightagainstcancernaturally
Www.winthefightagainstcancernaturallygustavorichard
 
Multi media presentation k kietzerow
Multi media presentation k kietzerowMulti media presentation k kietzerow
Multi media presentation k kietzerowkietzerowkf
 
Lavori alla Grotta 26/01/14
Lavori alla Grotta 26/01/14Lavori alla Grotta 26/01/14
Lavori alla Grotta 26/01/14
anakintech
 
Www.winthefightagainstcancernaturally.org
Www.winthefightagainstcancernaturally.orgWww.winthefightagainstcancernaturally.org
Www.winthefightagainstcancernaturally.orggustavorichard
 
Rmi presentation
Rmi presentationRmi presentation
Rmi presentation
Azad public school
 
Crt notes
Crt notesCrt notes
Uml manuu lab BY SARFARAZ HUSAIN
Uml manuu lab BY SARFARAZ HUSAINUml manuu lab BY SARFARAZ HUSAIN
Uml manuu lab BY SARFARAZ HUSAIN
Azad public school
 

Viewers also liked (8)

Www.winthefightagainstcancernaturally
Www.winthefightagainstcancernaturallyWww.winthefightagainstcancernaturally
Www.winthefightagainstcancernaturally
 
Multi media presentation k kietzerow
Multi media presentation k kietzerowMulti media presentation k kietzerow
Multi media presentation k kietzerow
 
Lavori alla Grotta 26/01/14
Lavori alla Grotta 26/01/14Lavori alla Grotta 26/01/14
Lavori alla Grotta 26/01/14
 
Www.winthefightagainstcancernaturally.org
Www.winthefightagainstcancernaturally.orgWww.winthefightagainstcancernaturally.org
Www.winthefightagainstcancernaturally.org
 
Cathoderaytube
CathoderaytubeCathoderaytube
Cathoderaytube
 
Rmi presentation
Rmi presentationRmi presentation
Rmi presentation
 
Crt notes
Crt notesCrt notes
Crt notes
 
Uml manuu lab BY SARFARAZ HUSAIN
Uml manuu lab BY SARFARAZ HUSAINUml manuu lab BY SARFARAZ HUSAIN
Uml manuu lab BY SARFARAZ HUSAIN
 

Similar to C programs pbq final

lets play with "c"..!!! :):)
lets play with "c"..!!! :):)lets play with "c"..!!! :):)
lets play with "c"..!!! :):)
Rupendra Choudhary
 
C basics
C basicsC basics
C basicsMSc CST
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans incnayakq
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
yogini sharma
 
C lab programs
C lab programsC lab programs
C lab programs
Dr. Prashant Vats
 
C lab programs
C lab programsC lab programs
C lab programs
Dr. Prashant Vats
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
Chris Ohk
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
KavyaSharma65
 
C Programming
C ProgrammingC Programming
C Programming
Sumant Diwakar
 
C file
C fileC file
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
Ashishchinu
 
Common problems solving using c
Common problems solving using cCommon problems solving using c
Common problems solving using c
ArghodeepPaul
 
Cpds lab
Cpds labCpds lab
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
Prasadu Peddi
 
Program flowchart
Program flowchartProgram flowchart
Program flowchart
Sowri Rajan
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
Rahul Pandit
 
9.C Programming
9.C Programming9.C Programming
9.C Programming
Export Promotion Bureau
 
C questions
C questionsC questions
C questions
MD Rashid
 

Similar to C programs pbq final (20)

lets play with "c"..!!! :):)
lets play with "c"..!!! :):)lets play with "c"..!!! :):)
lets play with "c"..!!! :):)
 
C basics
C basicsC basics
C basics
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
 
C lab programs
C lab programsC lab programs
C lab programs
 
C lab programs
C lab programsC lab programs
C lab programs
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
 
C Programming
C ProgrammingC Programming
C Programming
 
C file
C fileC file
C file
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
Common problems solving using c
Common problems solving using cCommon problems solving using c
Common problems solving using c
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
C
CC
C
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
 
Program flowchart
Program flowchartProgram flowchart
Program flowchart
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
 
9.C Programming
9.C Programming9.C Programming
9.C Programming
 
C questions
C questionsC questions
C questions
 
Tu1
Tu1Tu1
Tu1
 

More from Azad public school

software engineering
software engineeringsoftware engineering
software engineering
Azad public school
 
Computer science-view notices
Computer science-view noticesComputer science-view notices
Computer science-view notices
Azad public school
 
3.1 mining frequent patterns with association rules-mca4
3.1 mining frequent patterns with association rules-mca43.1 mining frequent patterns with association rules-mca4
3.1 mining frequent patterns with association rules-mca4
Azad public school
 
2. visualization in data mining
2. visualization in data mining2. visualization in data mining
2. visualization in data mining
Azad public school
 

More from Azad public school (9)

software engineering
software engineeringsoftware engineering
software engineering
 
Crt notes
Crt notesCrt notes
Crt notes
 
Computer science-view notices
Computer science-view noticesComputer science-view notices
Computer science-view notices
 
Amu
AmuAmu
Amu
 
2. data warehouse 2nd unit
2. data warehouse 2nd unit2. data warehouse 2nd unit
2. data warehouse 2nd unit
 
3. mining frequent patterns
3. mining frequent patterns3. mining frequent patterns
3. mining frequent patterns
 
3.1 mining frequent patterns with association rules-mca4
3.1 mining frequent patterns with association rules-mca43.1 mining frequent patterns with association rules-mca4
3.1 mining frequent patterns with association rules-mca4
 
2. olap warehouse
2. olap warehouse2. olap warehouse
2. olap warehouse
 
2. visualization in data mining
2. visualization in data mining2. visualization in data mining
2. visualization in data mining
 

Recently uploaded

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

C programs pbq final

  • 1.
  • 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; }
  • 6.
  • 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++)); }
  • 20.
  • 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)); }