Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
23 views
Assign Emt
Uploaded by
collegmemories0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Assign Emt For Later
Download
Save
Save Assign Emt For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
23 views
Assign Emt
Uploaded by
collegmemories0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Assign Emt For Later
Carousel Previous
Carousel Next
Save
Save Assign Emt For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 15
Search
Fullscreen
Dr B R Ambedkar National Institute of Technology Jalandhar Department of Computer Science and Engineering Assignment —2 Faculty : Dr. Lalatendu Behera Full Marks - 100 ‘Student Name: Branch Name: Roll Number: QL. Which of the following are invalid variable names and why? Rs] BASICSALARY basic basichra #MEAN group. 422 population in 2006 over time mindovermatter FLOAT hELLO queue. team’svictory Plot #3 2015_DDay Q2. Point out the errors, if any, in the following C statements, if there is an error write reason 0 (251 (2) int = 314.562 * 150; (b) name = ‘Ajay’ ; (©) varchar = ‘3’ ; (@)3.14*1*r*h=vol_of cyl; ()k=(a*b)(ct(25a+b)(d+e); (@) m_inst = rate of interest * amount in rs ; (g) si= principal * rateofinterest * numberofyears / 100 ; (hy area = 3.14 r=*2; (O volume = 3.14" r42*h; @k=((a*b)+)(25*a+b); Q3. Evaluate the following expressions and show their hierarchy. ray (a) g=big/2 + big * 4/big -big + abc /3;(abe = 2.5, big = 2, assume g to be a float) ()— on=ink * act/2+3/2* act+2+ ig; (ink = 4, act = 1, tig = 3.2, assume on to be an int) © wit add /4-6/2+2/3*6/ god; (qui = 4, add = 2, god = 2, assume s to be an int) @ 3*a/4-6/2+2/3*6/g; (a= 4, g=3, assume s to be an int) Q4. Convert the following equations into corresponding C statements. i Ge zo S8C+b)2/e-0542a/(q+r) (a+b)*Cim) as De (peDye? 4 (@ pa Wt622 (era) BtV (A= LDC +a)/e-0.8 +2b (xtra (lly)QS. What would be the output of the following programs: Is] @) void main { inti float a, b; keisj*is l=jlitiz he bajsimi; rintt( "6d %6d %f %f", k, 1, a, b); } (o) int main() { int a = 80, b = 85, c = 70,d = 75, e = 60; printf("Average of 5 subjects is: %0.2F", latb+c+d+e)/5.0); return 0; } (e) int main() { inta = 5, b= 8; printf("Numbers before swapping a = %d, b = %d", a,b); a=atb; ab; a=ab; printf("\nNumbers after swapping a = %d, b = %d", a,b); return 0; } 0) main() printf (“a = %db = %d", a,b); } @ main() { printf ("nn \n\n nin" ) ; prinef ("nn /n/n nnn" ) ; , eo main() { int pqs printf ("Enter values of p and q"); scanf (" %d %d", p,q); printt ("p= %d q =%d", p,q); }Q6. What would be the output of the following programs? [uo] (@) main() { int a= 300, b, ¢; if(a>= 400) b= 300; 100 ; printf ("\n%d %d", b,c); } (©) main() { int x = 10, y= 20; if(x==y)5 printf ("\n%d %d", x, y) 3 } (e) main() { int x = float y if(x printf ("\nx and y are equal” ) ; else printf ("\nx and y are not equal" ); yt (b) main() { int a= 500, b,c; if(a>=400) b= 300; c= 200; printf ("\n%d %d", b, ¢); } (@) main() { intx=3,y=5; if( ) printf ("\n%ql", x) else; printf ("\n%d", y , (8 main() { intx=3,y,25 y=x=10; z=x<10; printf ("nx = %d y = %d 2 = %d", x, y, 2); }@ main() { int k= 35; printf ("\n%d %d %d", k } = 35, k= 50, k> 40); o main( ) 5.b,c5 15; c=a
=}) printf ("\na and b are equal” ) ; } (© main() (@) main( ){ { if(X'<'x') int x= 10; printf ( "\nascii value of X is smaller than that of if (x >= 2) then x") printf ("\n9%d", x); } } (e) main() (8) main( ) { { int x= 10; int x= 10, y=15; ifx>=2 if (x% 2=¥%3) printf ("\nd%d", x); printf (*\nCarpathians” ) ; } } (g) main( ) (h) main( ) { { intx=30, y=40; int x= 10; if(x==y) if (x>=2) then printi( "x is equal to y" ); printf ("in%dl", x) elseif (x>y) } printf( “x is greater than y" ) ; elseif (x
50) if(i=5 &&2>5) prinef ("\nDean of students affairs" ); else printf ("wnDosa" ) ; , printf ("\wnLet us C" ); else printf ("wnWish C was free !" ) ; ,(©) main() { inti=4,j=-1,k=0,w, x,y,z; w=illjllk; X= 8& j &&k; y=illj&&k; Z=18&j||k; printf ("nw = %d x = %d y = %d-2 = %6d", W, x, ¥, 2); ) (e) main() { inti=-3,j=3; if(itj*1) printf ("\nMassaro” ) ; else printé ("\nBennarivo" ) ; } (g) main() { int p= 8,q= 20; if (p==5 &&q>5) printf ("\nWhy not G") ; else printf ("\nDefinitely C 1") ; ) (i) main() { intx=20,y=40,2=45; if(x>y&&x>z) printi( "x is big"); else if (y > x && y>z) (a) main() { inti=4,j=-1,k=0,y,2; yri+S&&j+1k+2; Z=i+5||j+1&&k+2; printf (“\ny = %d z= 96d", y, 2) 5 y (9 main( ) { int a= 40; if (a> 40 &&a<45) printf (“a is greater than 40 and less than 45" ) ; else printf ("96d a) } (hy main() { inti=-1,)= 1k); =i &&j; 1=illj printf (°%d % } LI): G) main() { int Is fills printf ("%d %d", i,j) 3prinei( "y is big") ; else if (2 > x && 2>y) printi( "2 is big” ); ) Q9. Point out the errors, if any, in the following programs and give reason of error: [8] @ main() { inti=2,j)=5; if(i== 2 &&j==5) printf ( "\nSatisfied at last" ); } (© main() { char spy ='a', password = if (spy == 'a' or password = printf ("\nAll the birds are safe in the nest" ) ; } (©) main() { int x = 10, y = 20; if (x>=2 andy <=50) printf ("\n%q", x); } (g) main() { int x = 2; if (x==2 &&x!=0); { (b) main() { int code, flag 5 if (code == 1 & flag == 0) printf ("\nThe eagle has landed” ) ; + (@) main { inti = 10, j=20; if(i=5) &&if (j= 10) printf ("\nHlave a nice day” ); } (Q main() { inta, b; if(a printf (\nGod is Great" ); } (b) main() { inti= 10, j=10 if (1 && j == 10) printf ("\nHave a nice day" );printf ( "nH" ); } printf( "\nHello” ) ; } else printf( "Bye" ) ; } Q10. What would be the output of the following programs: BI (a) main() (b) main() { { inti=-4,j, num; int k, num = 30 ; j= (num <0? 0: num * num ) ; = (num > 5 ? (num <= 10? 100 : 200) : 500); printf ("ind j); printf ("\n%d", num ) ; ) + (c) main() { imtj=45 (1j != 1? printf ("\nWelcome") : printf ( "\nGood Bye") ) ; } QU1. Point out the errors, if any, in the following programs: 7 (a) main() (b) main() { int tag = 0, code = 1; if (tag ==0) 29%", i) 5 code > 1? printf ("\nHello" ) ? printf ("\ "))5 printf ("\nHello Hi !!") ; } (©) main() (@ main() { { inti=10,j; inta=5,b=6; i>=52(j=10):(j=15); (a==b? printé( "%d",a) );princt ("ined %d", i,j) 5 , (e) main() { intn=9; ¢ ? printf( "You ate correct" ) ; prinef( "You are wrong" );) , (© main() { int kk = 65 ,I1; kk == 65 : printf ( "\n kk is equal to 65" ) : printf (Cn kk is not equal (0 65"); printf( "%d", IL) : } (g) main() { intx= 10, x== 20 && y != 10? printf( "True" prine{( "False" ); ) Q12. What would be the output of the following programs 18] (a) main() (b) main( ) { { intj; inti while (j <= 10) while (i<=10); { { printf ("\n9%d", j) 5 prinef ("wn%d", 1) 5 j=jrds itt; } , } } (©) main() (@) main() { { int; intx=1; while (j <= 10) while (x == 1) { printf ("in%q", 5); x=x-1; j=itl; printf ("\n%d", x) } }(e) main() { intx=1; while (x == 1) x=x-1 printf ("nd , (g) main() , @ main() { while (‘a' <'b') printf ( "\nmalyalam is a palindrome" ) ; } (&) main() { inti; while (i= 10) { prinef ("\n%d", i) ; isitt; } , } (8 main() { char x; while (x = 0; x <= 255 ;x*+) printf ("“\WnAscii value %d Character %e", x, x) 5 , (h) main() { intx=4,y=3,2; printf ("ind %d %d", x, y, 2) 3 , @) main() { inti=10 while (i= 20) printf ("nA computer buff!" ); > @ main() { float x = 1.1; while (x == 1.1) 4 pring ("wn%f", x); x=x-01; } ,(m) main() { while (‘1'<'2) printf (“\nln while loop" ) ; + (0) main() { intx=4, y=0, 2; while (x { we continue ; else printf (“ind %d"”, x, y ) 5 , } (q@ main() { inti=1,j)=1; for(s3) { if(i>5) break ; else jets printf ("\n%d", j); isis , } (13)Find the output for following programs (n) main) { char x ; for (x= 0; x <= 255; x++) printf ("\MnAscii value %d Character 6", XX) 5 + (p) main() { intx=4, y=0, 2; while (x>=0) { if(x==y) break ; else printf (“\n%d %d”, x, y) 5 yes } } () intmaing { inti=1,j=1; for(; js printi(” jaier <1; return 0; } 17](@) int main() { unsigned int a = 10; ana; prine{("%d\n", a); ) o void main() { int x= 97; int y = sizeof(x++); printh("x is %d", x); } © void main() { inta int k= (a+, ++a); prinef("%d\n", k); } () int main() ( if (~0 == 1) printf("yes\n"); else printf("no\n"); o (b) int main() { if (7 & 8) print{("Honesty"); if ((~7 & 0x000f) == 8) printf("is the best policy\n");} @) void main() { inta=5,b=-7,c=0,d; d= +a && +b | +6; printh("in%d%d%d%d", a,b, c, ds } o int main) { int x = +2; x=x2> 1 printf("%din", x); ) (h) void main() { float x = 0.1; if (== 0.1) print{("Sanfoundry"); else printf(" Advanced C Classes"); oint main void main { { unsigned int i = 23; float x = 0.1; signed char c= -23; printf("%d, ", »); if(i>o printt("%f", x); printi("Yest y else if (i <0) printf("No\n"); } 6 0 void main int main() { { double ch; switch (printf("Do")) printf(“enter a value between 1 to 2:"); q scanf("%I0", &ch); case 1: switch (ch) printf("Firstin"); break; case 2: print{("Second\n"); break; default: printf("Defaultin"); break; ) ) ) (m) (a) int main) int main() { { inti=0,}=0; inti=0; while (<5, |< 10) { itt; ies } continue; printf("%d, %6dh\n", i,j); printf("In while loop "); ) } while (i < 2); printf("%din", 1);© int main() { inti=0, j= 0, for (i 1< 25: for j= 0;) <3; printf("Lin"); break; } prinef("2\n"); } print{(“after loop\n"); , @ int main() { inti=0, j=0; while (1 < 2) { Titty while (<3) { printf("Loop\n"); goto 11; } } , ©) int main { inti= char ¢= "a while (i < 2){ iss switch (c) { primtf("9%c ", ); break; break; } ) printf("after loopin");
You might also like
Hourglass Workout Program by Luisagiuliet 2
PDF
76% (21)
Hourglass Workout Program by Luisagiuliet 2
51 pages
Book of Wisdom Revival of Wisdom
PDF
89% (93)
Book of Wisdom Revival of Wisdom
72 pages
12 Week Program: Summer Body Starts Now
PDF
87% (46)
12 Week Program: Summer Body Starts Now
70 pages
Read People Like A Book by Patrick King-Edited
PDF
58% (81)
Read People Like A Book by Patrick King-Edited
12 pages
Livingood, Blake - Livingood Daily Your 21-Day Guide To Experience Real Health
PDF
77% (13)
Livingood, Blake - Livingood Daily Your 21-Day Guide To Experience Real Health
260 pages
Cheat Code To The Universe
PDF
94% (79)
Cheat Code To The Universe
34 pages
Facial Gains Guide (001 081)
PDF
91% (45)
Facial Gains Guide (001 081)
81 pages
Curse of Strahd
PDF
95% (467)
Curse of Strahd
258 pages
The Psychiatric Interview - Daniel Carlat
PDF
91% (34)
The Psychiatric Interview - Daniel Carlat
473 pages
Can't Hurt Me
PDF
69% (29)
Can't Hurt Me
10 pages
The Borax Conspiracy
PDF
91% (57)
The Borax Conspiracy
14 pages
Combs Indictment
PDF
91% (11)
Combs Indictment
14 pages
Trauma-Focused ACT - Russ Harris
PDF
95% (39)
Trauma-Focused ACT - Russ Harris
568 pages
Anastasia: The New Broadway Musical (LIBRETTO)
PDF
94% (175)
Anastasia: The New Broadway Musical (LIBRETTO)
117 pages
COSMIC CONSCIOUSNESS OF HUMANITY - PROBLEMS OF NEW COSMOGONY (V.P.Kaznacheev,. Л. V. Trofimov.)
PDF
94% (214)
COSMIC CONSCIOUSNESS OF HUMANITY - PROBLEMS OF NEW COSMOGONY (V.P.Kaznacheev,. Л. V. Trofimov.)
212 pages
I Hate You - Don't Leave Me
PDF
80% (54)
I Hate You - Don't Leave Me
6 pages
TDA Birth Certificate Bond Instructions
PDF
97% (285)
TDA Birth Certificate Bond Instructions
4 pages
The Secret Language of Attraction
PDF
86% (107)
The Secret Language of Attraction
278 pages
How To Develop and Write A Grant Proposal
PDF
83% (542)
How To Develop and Write A Grant Proposal
17 pages
Penis Enlargement Secret
PDF
60% (124)
Penis Enlargement Secret
12 pages
Workbook For The Body Keeps The Score
PDF
89% (53)
Workbook For The Body Keeps The Score
111 pages
Donald Trump & Jeffrey Epstein Rape Lawsuit and Affidavits
PDF
83% (1016)
Donald Trump & Jeffrey Epstein Rape Lawsuit and Affidavits
13 pages
KamaSutra Positions
PDF
78% (69)
KamaSutra Positions
55 pages
7 Hermetic Principles
PDF
93% (30)
7 Hermetic Principles
3 pages
27 Feedback Mechanisms Pogil Key
PDF
77% (13)
27 Feedback Mechanisms Pogil Key
6 pages
Frank Hammond - List of Demons
PDF
92% (92)
Frank Hammond - List of Demons
3 pages
Phone Codes
PDF
79% (28)
Phone Codes
5 pages
36 Questions That Lead To Love
PDF
91% (35)
36 Questions That Lead To Love
3 pages
How 2 Setup Trust
PDF
97% (307)
How 2 Setup Trust
3 pages
2025 MandateForLeadership FULL
PDF
70% (10)
2025 MandateForLeadership FULL
920 pages
How To Kiss A Woman's Breast
PDF
60% (114)
How To Kiss A Woman's Breast
14 pages
100 Questions To Ask Your Partner
PDF
78% (36)
100 Questions To Ask Your Partner
2 pages
The 36 Questions That Lead To Love - The New York Times
PDF
94% (34)
The 36 Questions That Lead To Love - The New York Times
3 pages
Satanic Calendar
PDF
25% (56)
Satanic Calendar
4 pages
The 36 Questions That Lead To Love - The New York Times
PDF
95% (21)
The 36 Questions That Lead To Love - The New York Times
3 pages
Jeffrey Epstein39s Little Black Book Unredacted PDF
PDF
75% (12)
Jeffrey Epstein39s Little Black Book Unredacted PDF
95 pages
14 Easiest & Hardest Muscles To Build (Ranked With Solutions)
PDF
100% (8)
14 Easiest & Hardest Muscles To Build (Ranked With Solutions)
27 pages
ALCHEMIST
PDF
64% (14)
ALCHEMIST
4 pages
1001 Songs
PDF
69% (72)
1001 Songs
1,798 pages
The 4 Hour Workweek, Expanded and Updated by Timothy Ferriss - Excerpt
PDF
23% (954)
The 4 Hour Workweek, Expanded and Updated by Timothy Ferriss - Excerpt
38 pages
Zodiac Sign & Their Most Common Addictions
PDF
63% (30)
Zodiac Sign & Their Most Common Addictions
9 pages
Computer Programming Assignment-1: (Submission Date: 10/02/2021)
PDF
No ratings yet
Computer Programming Assignment-1: (Submission Date: 10/02/2021)
15 pages
Saumya Gupta IT-2 09213203120 Assignment
PDF
No ratings yet
Saumya Gupta IT-2 09213203120 Assignment
17 pages
Assignment: Computer Science
PDF
No ratings yet
Assignment: Computer Science
8 pages
Name: Student Id: Section: Signature
PDF
No ratings yet
Name: Student Id: Section: Signature
4 pages
C Quiz
PDF
No ratings yet
C Quiz
20 pages
Written Quizzes Solutions Spring
PDF
No ratings yet
Written Quizzes Solutions Spring
33 pages
CF Chap2 Engineering Fe Mcq's
PDF
100% (2)
CF Chap2 Engineering Fe Mcq's
54 pages
Assignment 2 Anshuman
PDF
No ratings yet
Assignment 2 Anshuman
6 pages
COSC101 PRACTICE QUESTIONS
PDF
No ratings yet
COSC101 PRACTICE QUESTIONS
7 pages
Control STR Ifswitch19to11!24!11 20111
PDF
No ratings yet
Control STR Ifswitch19to11!24!11 20111
3 pages
Amcat
PDF
No ratings yet
Amcat
32 pages
AROOJ
PDF
No ratings yet
AROOJ
27 pages
200 Objective-Type Questions Ramesh
PDF
No ratings yet
200 Objective-Type Questions Ramesh
32 pages
DPP 3
PDF
No ratings yet
DPP 3
6 pages
One Word
PDF
No ratings yet
One Word
22 pages
Chapter 10 Errors and outputs - final
PDF
No ratings yet
Chapter 10 Errors and outputs - final
3 pages
Additional C Questions
PDF
No ratings yet
Additional C Questions
41 pages
Midsem Exam
PDF
No ratings yet
Midsem Exam
8 pages
C Basic Questions
PDF
No ratings yet
C Basic Questions
7 pages
C - Complete Notes
PDF
No ratings yet
C - Complete Notes
57 pages
c language output finding
PDF
No ratings yet
c language output finding
6 pages
Name: Student Id: Section: Signature
PDF
No ratings yet
Name: Student Id: Section: Signature
4 pages
C Assignment
PDF
No ratings yet
C Assignment
26 pages
Key CP 2 Prog C
PDF
No ratings yet
Key CP 2 Prog C
32 pages
Solution Assignment
PDF
No ratings yet
Solution Assignment
5 pages
100 C Objectives
PDF
No ratings yet
100 C Objectives
37 pages
Mt1 With Answers
PDF
No ratings yet
Mt1 With Answers
4 pages
Chapter 2 Outputs and Errors
PDF
No ratings yet
Chapter 2 Outputs and Errors
11 pages
My C Notes
PDF
100% (1)
My C Notes
9 pages
2CS101 Detailed List of Tutorials
PDF
No ratings yet
2CS101 Detailed List of Tutorials
7 pages
C Sample Qyestions
PDF
0% (1)
C Sample Qyestions
145 pages
Most Important Programs of CPS Theory Exam
PDF
No ratings yet
Most Important Programs of CPS Theory Exam
11 pages
Final
PDF
No ratings yet
Final
8 pages
Smt. Bhagwati Chaturvedi College of Engineering: Spandan-2012
PDF
No ratings yet
Smt. Bhagwati Chaturvedi College of Engineering: Spandan-2012
4 pages
Let Us C Solution
PDF
No ratings yet
Let Us C Solution
16 pages
EMU CMPE112 - CMSE112 - Exercises (19273)
PDF
No ratings yet
EMU CMPE112 - CMSE112 - Exercises (19273)
18 pages
Aptitude Questions Inautix Technologies India Limited Section A
PDF
No ratings yet
Aptitude Questions Inautix Technologies India Limited Section A
32 pages
Programming in C Journal
PDF
No ratings yet
Programming in C Journal
51 pages
Book Chapter 3 Programming With C
PDF
No ratings yet
Book Chapter 3 Programming With C
36 pages
BCA C LAB MANUAL 2024-28
PDF
No ratings yet
BCA C LAB MANUAL 2024-28
22 pages
ESC 101: Fundamentals of Computing Name Roll No Dept. Section
PDF
No ratings yet
ESC 101: Fundamentals of Computing Name Roll No Dept. Section
8 pages
Conditional and Looping Statements: Answer: Explanation
PDF
No ratings yet
Conditional and Looping Statements: Answer: Explanation
10 pages
DPP 2
PDF
No ratings yet
DPP 2
9 pages
15-16 Midsem Solutions Makeup PDF
PDF
No ratings yet
15-16 Midsem Solutions Makeup PDF
5 pages
C Programmes Full
PDF
No ratings yet
C Programmes Full
49 pages
PPS Lab Quiz
PDF
No ratings yet
PPS Lab Quiz
2 pages
C Programs
PDF
No ratings yet
C Programs
51 pages
Multiple Choice Questions
PDF
No ratings yet
Multiple Choice Questions
4 pages
Q. No. Topic: Ekas Singh - 1-C
PDF
No ratings yet
Q. No. Topic: Ekas Singh - 1-C
41 pages