Download as pdf
Download as pdf
You are on page 1of 2
a, y BIRLA INSTITUTE OF TECHNOLOGY ANT) SCIENCE, PILANI (RAJ.) First Semester 2021-22 cA CS F111 COMPUTER PROGRAMMING NAME: Prateek Koankes of ID: 2021-A1PS 144@p Mar 09, 2022 “" MID_SEMESTER EXAMINATION 50 M, 1.5 hrs. There are two parts in this exam PART A is in-built; please write your answers in the space provided Ensure you have both sides of PART A printed Please write your name and ID on the top of both answer sheets. ‘Once you turn in PART A after 45 min, PART B would be given ‘Assume all required header files and return statements are included for the C codes given. I. State true of false for each statement, with justification. No mark shall be awarded without proper” [4 justification. 6] i. Theline #include gets replaced by the contents ofthe file staio. during inking| Fole\ olots tuts Joak > ow Peete Ht inctucte Der eet rie Cece ete Andugs - sinter colds vi Limbo, i Wh Rata title hsm i aTthce Ede of 5°43, results in an overtio OWLPtge occu ohn “Pre finer nt peeasy nie We witan traemocdues. Hore "2" i ii area sian Saree paca emnt oe vege of Abits, int a, wv. “ic compile at Pie feenrarss rsh ccd Short int is fine lout cloubte Lent, os SO ay borg format for LAE) + So Wnt 90 week Levy PR wohl aS Ramey Perens ee ene eelee| shores Siqnuect bits ole trot Lomplemait 4usk tele comp aunt actdsme te Pee conrantd Soe as an integral value. ay com of Bvre numbers . Staging auesge Comvictere eee O40 IF iWkemmatey, THA is loa $+ rouse ¥. Pra) nex vii coe three loop constrllcts in C are pre-test loops. {Tt +t Urotacter. For ond while are enty Contrrtted. Py while ts Oxi contrrticel , vii, _prime and for_stmt are examples of valid identifiers in C. , ldenti fers Stet Qetters or — may Lanter Cob es, wubaloces oy Y , Cpe tah Pa ix. The char type is treated internally as always unsigned. a ne Uae Gu O+ rt oles even if Yeu Ck. Sip ntl “apm ik x. The expression 295 when printed as an integer a the value 32, (Peoe da bitatne Kok aac aed occ if You Ure pow) funchor Il. Answer the following questions briefly rer ‘he [6] a. What does the expression: x = x & ~077 accomplish? 077 bs Lowrider octal '. INU an lomary-. TAEDA frwerts pe bits te 000000 Finely , & Ceitwike AND) operator AUS upon K (ODO 000 10 evrentuatly | Ratle € Lise nal = Stores 20 into % . ite a unix command to print the middle two lines (lines 15 and 16) of a file nafnedScode.¢ which contains 30 lines of code. You may use any command you have learnt in class/lab including piping ‘c. What does the following command accomplish? 1 “Al txt we a1 IN YoUy is -1 | grep © eet ob Filan or directeriCs dérecery Irak canta "tab" 1A Tr dun vosulr Qrep Product, wack in| inn bong Littett formas of te III, Write down the output of the following snippets of code, If you think there's some bug. in the code, you may ‘write it as well 0} mes hit 3? 3£G82==0) 1 i '=2; font inue; ? 4£(482 00) gat continue; printf ("td td td", i, dpm? KG Ourput: Tnt =I, a=5,be5; Af (sizeof (cma-b) Print£(“A") ; if (c==a-b) printf ("8"); else printf("c”) ) (45) 63, (8, 5)) Int pel, q-2, F3, a4 int t-0;t = q+rep* printf ("d, d\n", 8, t) print ie Ourput: int y =. 8/443s5-304 Af (>be) pr: printe("td 4d", x,y) else printe ("FAL . 0 Ourputs 3 Ourpur: FALSE nt a= 2, be, 6 = 0 Int x7 1 int do oly 022, ade x2) 21,2) for (x = 7; x != 0; printt("% = 4d") -gg)s Oupur: 226 2124 2022 & IV. The following flowchart multiplies two numbers, M and N. Multiplication is done by repeatedly adding M, N times (flow chart should also do the same, i.e. adding M, N times). Correct the flow chart (if there are any mistakes) and complete it. Mistakes can be corrected in the flow chart by clearly cutting the text inside the box and writing correct expression /text adjacent to it. [ye ourpurs, Cae) Declare Antegers 620, iol i) bogie ©

You might also like