This document contains multiple choice questions related to C programming, SQL, and UML. It tests knowledge of topics like automatic variables in functions, data types, loops, arrays, pointers, structures, functions, and SQL statements like SELECT, JOIN, WHERE clauses. The questions cover concepts like dynamic memory allocation, I/O functions, data structures, and relational database queries.
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
77 views
Topics - C, SQL and UML
This document contains multiple choice questions related to C programming, SQL, and UML. It tests knowledge of topics like automatic variables in functions, data types, loops, arrays, pointers, structures, functions, and SQL statements like SELECT, JOIN, WHERE clauses. The questions cover concepts like dynamic memory allocation, I/O functions, data structures, and relational database queries.
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 18
Topics C, SQL and UML
1. Which of the following about automatic a!iables within a function
is co!!ect " a.its t#pe must be decla!ed befo!e using the a!iable b.the# a!e local c.the# a!e not initialised to $e!o d.the# a!e global. %.Which of the following is not an infinite loop " a.while&1'( .... ) b.fo!&**'( ... ) c.+,-* do( ./+ unalte!ed within theloop/. ... )while&+,,-'* d.0 define T1U2 - ... while&T1U2'( .... ) 3.a memo!# of %- b#tes is allocated to a st!ing decla!ed as cha! /s then the following two statements a!e e+ecuted4 s,52nt!ance5 l,st!len&s'* what is the alue of l " a.%- b.6 c.7 d.%1 8.gien the piece of code int a9:-;* int /pa* pa,a* to access the <th element of the a!!a# which of the following is inco!!ect" a./&a=:' b.a9:; c.pa9:; d./&/pa = :' :.cond 1"cond %"cond 3"4e+p 14e+p %4e+p 34e+p 8* is e>uialent to which of the following" a.if cond 1 e+p 1* else if cond % e+p %* else if cond 3 e+p 3* else e+p 8* b.if cond 1 if cond % if cond 3 e+p 1* else e+p %* else e+p 3* else e+p 8* c.if cond 1 ?? cond % ?? cond 3 e+p 1 @e+p %@e+p 3@e+p 8* d.if cond 3 e+p 1* else if cond % e+p %* else if cond 1 e+p 3* else e+p 8* <.which of the following go out of the loop if e+pn % becoming false a.while&e+pn 1'(...if&e+pn %'continue*) b.while&Ae+pn 1'(if&e+pn %'continue*...) c.do(..if&e+pn 1'continue*..)while&e+pn %'* d.while&Ae+pn %'(if&e+pn 1'continue*..) B.0 define p!od&a,b',a/b main&' ( int +,%* int #,3* p!intf&5Cd5,p!od&+=%,#D1-''* ) the output of the p!og!am is a.6 b.< c.B d.none 6.find the output of the following p!og!am main&' ( int +,:, /p* p,?+* p!intf&5Cd5,==/p'* ) a.: b.< c.- d.none 1-. What Will be the output" oid main&' ( intcount,1-,/temp,sum,-* temp,?count* /temp,%-* temp,?sum* /temp,count* p!intf&5Cd Cd Cd 5,count,/temp,sum'* ) a. %- %- %- b. %1 %- %1 c. %% %- %- d. Eone of the aboe. 11. Find the output fo! the following C p!og!am main&' ( int +,%-,#,3:* + , #== = +==* # , ==# = ==+* p!intf&5Cd CdGn5,+,#'* ) a. :B 78 b. :< 78 c. :B 7: d. :B 73 1% Find the output fo! the following C p!og!am main&' ( int +,:* p!intf&5Cd Cd CdGn5,+,+HH%,+II%'* ) a. : %- 1 b. : % 1 c. : 1: % d. Eone of the aboe. 13. Find the output fo! the following C p!og!am main&' ( cha! /pt! , 51amco S#stems5* &/pt!'==* p!intf&5CsGn5,pt!'* pt!==* p!intf&5CsGn5,pt!'* ) a. 1amco S#stems b. Cs1amco S#stems c. s1amco S#stems d. samco S#stems 18. Find the output fo! the following C p!og!am 0includeHstdio.hI oid main&oid' ( unsigned int c* unsigned +,-+3* scanf&5Cu5,?c'* switch&c?+' ( case 34 p!intf&5JelloAGt5'* case %4 p!intf&5WelcomeGt5'* case 14 p!intf&5To KllGt5'* default4p!intf&5Gn5'* ) ) a. Jello b. Jello Welcome c. Jello Welcome To Kll d. Eone of the aboe. 1:. W!ite the output fo! the following C p!og!am 0includeHstdio.hI oid main&oid'* static int i,:-* int p!int&int i'* oid main&oid' ( static int i,1--* while&p!int&i'' ( p!intf&5CdGn5,i'* iDD* ) ) int p!int&int +' ( static int i,%* !etu!n&iDD'* ) 1<. K!!a# passed as an a!gument to a function is inte!p!eted as 1' Kdd!ess of the a!!a# %' Lalues of the fi!st elements of the a!!a# 3' Kdd!ess of the fi!st element of the a!!a# 8' Eumbe! of element of the a!!a# 1B. Jow can M d#namicall# allocate a twoDdimensional a!!a#" 1' int //a!!a#1 , &int //'malloc&n!ows / si$eof&int /''* fo!&i , -* i H n!ows* i==' a!!a#19i; , &int /'malloc&ncolumns / si$eof&int''* %' int //a!!a#% , &int //'malloc&n!ows / si$eof&int /''* a!!a#%9-; , &int /'malloc&n!ows / ncolumns / si$eof&int''* fo!&i , 1* i H n!ows* i==' a!!a#%9i; , a!!a#%9-; = i / ncolumns* 3' int /a!!a#3 , &int /'malloc&n!ows / ncolumns / si$eof&int''* 8' Kn# of the aboe. 16. main&' ( cha! thought9%;93-;,(5NonOt walP in f!ont of me..5,5M am not follow5)* p!intf&5CcCc5,/&thought9-;=7',/&/&thought=-'=:''* ) What is the output of this p!og!am" 1' P P %' NonOt walP in f!ont of me 3' M ma# not follow 8' P 17 0include Hstdio.hI oid main&' ( int M,3,/Q,//P* Q,?M* P,?Q* p!intf&5CdCdCd5,/Q,//P,/&/P''* ) What is the output of the aboe p!og!am code"
1' 888 %' --- 3' 333 8' 833 %-. main&' ( st!uct ( int i* )/+#$* &+#$'DIi,1-* p!intf&5Cd5,+#$DIi'* ) What is the output of this p!og!am" 1' p!og!am will not compile %' 1- 3' god onl# Pnows 8' add!ess of M %1. What would be the output of the following p!og!am" 0include Hstdio.hI main&' ( cha! st!9;,5SG-<:GKR5* p!intf&5GnCd5, si$eof&st!''* ) 1' % %' < 3' : 8' e!!o! %%. fputs function is used to i. w!ite cha!acte!s to a file ii. taPes % pa!amete!s iii. !etu!ns a cha!acte! i. !e>ui!es a file pointe!
1' all a!e t!ue %' all a!e false 3' onl# i and ii a!e t!ue 8' onl# i,ii and i a!e t!ue %3. 0include Hstdio.hI oid main&' ( int a* p!intf&5Cd5,aSa'* ) 1' 1 %' - 3' Une+pected 8' 1untime 2!!o! %8. What is the output of the following code" 0includeHstdio.hI oid swap&int /, int /'* oid main&' ( int a , 1-,b,%-* swap &?a==, ?b=='* p!intf&5GnCdGtCdGt5,a, b'* ) oid swap&int? +, int? #' ( +=,%* #=,3* ) 1' 18, %8 %' 11, %1 3' 1-, %- 8' 2!!o! %:. What is the output of the following code" 0includeHstdio.hI oid main&' ( int a,-,b,-* a , &b , B:' = 7* p!intf&5GnCd, Cd5,a, b'* ) 1' B:, 7 %' B:, 68 3' 68, B: 8' Eone of these options %<. Which of the following p!og!amming techni>ue focuses on the algo!ithm. 1' T!ocedu!al language %' UbQect o!iented language 3' UbQect based language 8' St!uctu!al language %B. What is the output of the following code" 0includeHstdio.hI oid main&' ( int s,-* while&s==H1-' ( if&sH8 ?? sH7' continue* p!intf&5GnCdGt5,s'* ) ) %6. Which one of the following p!oides conceptual suppo!t fo! function calls" Choice 1 The s#stem stacP Choice % The data segment Choice 3 The p!ocesso!Vs !egiste!s Choice 8 The te+t segment Choice : The heap %7. Code4 cha! /pt!* cha! m#St!ing9; , 5abcdefg5* pt! , m#St!ing* pt! =, :* What st!ing does pt! point to in the sample code aboe" Choice 1 fg Choice % efg Choice 3 defg Choice 8 cdefg Choice : Eone of the aboe 3-. Wie the output fo! the following p!og!am. 0define STXL21 cha! main&' ( t#pedef cha! STXL2%* STXL21 +* STXL2% #* cl!sc!&'* +,%::* #,%::* p!intf&YCd CdGnZ,+,#'* ) Question: 31 Which S2L2CT statement should #ou use if #ou want to displa# uni>ue combinations of the TUSMTMUE and MKEKW21 alues f!om the 2MTLUX22 table" K. S2L2CT NMSTMECT position, manage! F1UM emplo#ee* R. S2L2CT position, manage! NMSTMECT F1UM emplo#ee* C. S2L2CT position, manage! F1UM emplo#ee* N. S2L2CT position, NMSTMECT manage! F1UM emplo#ee* Question: 32 Xou need to p!oduce a !epo!t fo! mailing labels fo! all custome!s. The mailing label must hae onl# the custome! name and add!ess. The CUSTUM21S table has these columns4 CUST[MN EUMR21&8' EUT EULL CUST[EKM2 LK1CJK1%&1--' CUST[KNN12SS LK1CJK1%&1:-' CUST[TJUE2 LK1CJK1%&%-' Which S2L2CT statement accomplishes this tasP" K. S2L2CT/ F1UM custome!s* R. S2L2CT name, add!ess F1UM custome!s* C. S2L2CT id, name, add!ess, phone F1UM custome!s* N. S2L2CT cust[name, cust[add!ess F1UM custome!s* 2. S2L2CT cust[id, cust[name, cust[add!ess, cust[phone F1UM custome!s*. Question: 33 2aluate this SQL statement4 S2L2CT e.2MTLUX22[MN,e.LKST[EKM2,e.N2TK1TM2ET[MN, d.N2TK1TM2ET[EKM2. F1UM 2MT e, N2TK1TM2ET d WJ212 e.N2TK1TM2ET[MN , d.N2TK1TM2ET[MN* Mn the statement, which capabilities of a S2L2CT statement a!e pe!fo!med" K. Selection, p!oQection, Qoin R. Niffe!ence, p!oQection, Qoin C. Selection, inte!section, Qoin N. Mnte!section, p!oQection, Qoin 2. Niffe!ence, p!oQection, p!oduct Question: 34 Which two statements a!e t!ue !ega!ding the U1N21 RX clause" &Choose two' K. The so!t is in ascending b# o!de! b# default. R. The so!t is in descending o!de! b# default. C. The U1N21 RX clause must p!ecede the WJ212 clause. N. The U1N21 RX clause is e+ecuted on the client side. 2. The U1N21 RX clause comes last in the S2L2CT statement. F. The U1N21 RX clause is e+ecuted fi!st in the >ue!# e+ecution. Question: 35 The CUSTUM21S table has these columns4 CUSTUM21[MN EUMR21&8' EUT EULL CUSTUM21[EKM2 LK1CJK1%&1--' EUT EULL ST122T[KNN12SS LK1CJK1%&1:-' CMTX[KNN12SS LK1CJK1%&:-' STKT2[KNN12SS LK1CJK1%&:-' T1ULMEC2[KNN12SS LK1CJK1%&:-' CUUET1X[KNN12SS LK1CJK1%&:-' TUSTKL[CUN2 LK1CJK1%&1%' CUSTUM21[TJUE2 LK1CJK1%&%-' Which statement finds the !ows in the CUSTUM21S table that do not hae a postal code" K. S2L2CT custome![id, custome![name F1UM custome!s WJ212 postal[code CUETKMES EULL* R. S2L2CT custome![id, custome![name F1UM custome!s WJ212 postal[code , V[[[[[[[[V* C. S2L2CT custome![id, custome![name F1UM custome!s WJ212 postal[code MS EULL* N. S2L2CT custome![id, custome![name F1UM custome!s WJ212 postal code MS ELL* 2. S2L2CT custome![id, custome![name F1UM custome!s WJ212 postal[code , EULL* Question: 36 2aluate these two SQL statements4 S2L2CT last[name, sala!# , hi!e[date F1UM 2MTLUX22S U1N21 RX sala!# N2SC* S2L2CT last[name, sala!#, hi!e[date F1UM 2MTLUX22S U1N21 RX % N2SC* What is t!ue about them" K. The two statements p!oduce identical !esults. R. The second statement !etu!ns a s#nta+ e!!o!. C. The!e is no need to specif# N2SC because the !esults a!e so!ted in descending o!de! b# default. N. The two statements can be made to p!oduce identical !esults b# adding a column alias fo! the sala!# column in the second SQL statement. Question: 37 2+amine the data of the 2MTLUX22S table. 2MTLUX22S &2MTLUX22[MN is the p!ima!# Pe#. MW1[MN is the MN of manage!s and !efe!s to the 2MTLUX22[MN' 2MTLUX22[MN 2MT[EKM2 N2TT[MN MW1[MN \UR[MN SKLK1X 1-1 Smith %- 1%- SK[12T 8--- 1-% Ma!tin 1- 1-: CL21] %:-- 1-3 Ch!is %- 1%- MT[KNMME 8%-- 1-8 \ohn 3- 1-6 J1[CL21] %:-- 1-: Niana 3- 1-6 J1[MW1 :--- 1-< R!#an 8- 11- KN[KSST 3--- 1-6 \ennife! 3- 11- J1[NM1 <:-- 11- Rob 8- 2^[NM1 6--- 1%- 1ai %- 11- SK[NM1 <:-- 2aluate this SQL statement4 S2L2CT e.emplo#ee[id 52mp[id5, e.emp[name 52mplo#ee5, e.sala!#, m.emplo#ee[id 5Mg![id5, m.emp[name 5Manage!5 F1UM emplo#ees e, emplo#ees m WJ212 e.mg![id , m.emplo#ee[id KEN e.sala!# I 8---* What is its output" K. 2MT[id 2MTLUX22 SKLK1X Mg![id Manage! DDDDDDD DDDDDDDDDD DDDDDDDDD DDDDDDDDDDDDD DDDDDDDDDDDDDD 11- Rob 6--- Rob 1%- 1ai <:-- 11- 1ai 1-6 \ennife! <:-- 11- \ennife! 1-3 Ch!is 8%-- 1%- Ch!is 1-: Niana :--- 1-6 Niana R. 2MT[id 2MTLUX22 SKLK1X Mg![id Manage! DDDDDDD DDDDDDDDDD DDDDDDDDD DDDDDDDDDDDDD DDDDDDDDDDDDDD 1%- 1ai <:-- 11- Rob 1-6 \ennife! <:-- 11- Rob 1-3 Ch!is 8%-- 1%- 1ai 1-: Niana :-- 1-6 \ennife! C. 2MT[id 2MTLUX22 SKLK1X Mg![id Manage! DDDDDDD DDDDDDDDDD DDDDDDDDD DDDDDDDDDDDDD DDDDDDDDDDDDDD 11- Rob 6-- 1%- 1ai <:-- 11- Rob 1-6 \ennife! <:-- 11- Rob 1-3 Ch!is 8%-- 1%- 1ai 1-: Niana :--- 1-6 \ennife! N 2MT[id 2MTLUX22 SKLK1X Mg![id Manage! DDDDDDD DDDDDDDDDD DDDDDDDDD DDDDDDDDDDDDD DDDDDDDDDDDDDD 11- Rob 6--- 11- Rob 1%- 1ai <:-- 1%- 1ai 1-6 \ennife! <:-- 1-6 \ennife! 1-3 Ch!is 8%-- 1-3 Ch!is 1-: Niana :--- 1-: Nina 2. The SQL statement p!oduces an e!!o!. Question: 38. Which .SQL/Tlus featu!e can be used to !eplace alues in the WJ212 clause" K. Substitution a!iables R. 1eplacement a!iables C. T!ompt a!iables N. MnsteadDof a!iables 2. This featu!e cannot be implemented th!ough .SQL/Tlus. Question: 39 Xou a!e fo!mulating >ue!ies in a SQL/Tlus. Which of the following statement co!!ectl# desc!ibes how to specif# a column alias" K. Tlace the alias at the beginning of the statement to desc!ibe the table. R. Tlace the alias afte! each column sepa!ated b# a space to desc!ibe the column. C. Tlace the alias afte! each column sepa!ated b# a comma to desc!ibe the column. N. Tlace the alias at the end of the statement to desc!ibe the table. Question: 40 Xou want to use a function in #ou column clause of a SQL statement. The ELL function accomplishes which of the following tasPs" K. Kssists in the dist!ibution of output ac!oss multiple columns. R. 2nables #ou to specif# alte!nate output fo! nonDEULL column alues. C. 2nables #ou to specif# alte!nated out fo! EULL column alues. N. Eullifies the alue of the column out put. Question 81 Kn se>uence diag!am is4 a. a timeDline illust!ating a t#pical se>uence of calls between obQect function membe!s b. a call t!ee illust!ating all possible se>uences of calls between class function membe!s c. a timeDline illust!ating the changes in inhe!itance and instantiation !elationships between classes and obQects oe! time d. a t!ee illust!ating inhe!itance and !elationships between classes
Question 8% Mn the UML notation a class can be !ep!esented b# 4 a. K !ectangula! bo+ with the name of the class in the bo+ b. K !ectangula! bo+ with the name of the obQect, a 4 and the class name that the obQect belongs to c. K !ectangula! bo+ with the class name p!efi+ed b# the wo!d 5class5 d. K thin e!tical line with Pe# method calls shown as outwa!d a!!ows
Question 83. Mf #ou want to plan p!oQect actiities such as deeloping new functionalities o! test cases, of the following UUKN a!tifacts is the most useful" &a' Se>uence diag!ams &b' Use cases &c' Nomain model &d' TacPage diag!ams Question 88. Which of the following is ite!atie, inc!emental, use case d!ien and a!chitectu!e cent!ic" &a' LDmethod &b' UML &c' Component Rased Neelopment &d' 1UT Question 8:. Conside! a bee!age machine. Mf the acto! is _custome!`, and the scope is _machine`, what is most liPel# to be found in the main scena!io of the use case _get d!inP`" &a' D ente! choice D if d!inP aailable then show p!ice D put in coins D if paid enough then delie! d!inP &b' D custome! ente!s choice D machine shows p!ice D custome! puts in coins D machine delie!s d!inP &c' D ente! choice D show p!ice D put in coins D delie! d!inP &d' D ... D machine sends p!ice to LCN displa# D custome! put coins in slot D coin mechanism e!ifies amount and tells machine cont!olle! D machine cont!olle! actiates boile! Question 8<. Mf #ou need to show the ph#sical !elationship between softwa!e components and the ha!dwa!e in the delie!ed s#stem, which diag!am can #ou use" &a' component diag!am &b' deplo#ment diag!am &c' class diag!am &d' netwo!P diag!am Question 8B. What a!e the most useful UML diag!ams and !elated info!mation that can be used to !ep!esent a WebKpp inte!action model" a. actiit# diag!ams, class diag!ams, state diag!ams, inte!face p!otot#pe b. actiit# diag!ams, collabo!ation diag!ams, se>uence diag!ams, state diag!ams c. useDcases, se>uence diag!ams, state diag!ams, inte!face p!otot#pe d. useDcases, se>uence diag!ams, state diag!ams, se>uence diag!ams Question 86 Kgg!egation &encapsulation' !elationships a!e !ep!esented in the UML notation b#4 a. nesting of classes b. lines with a solid diamond at one end c. lines with a hollow diamond at one end d. lines with an a!!ow at one end e. lines without an a!!ow at eithe! end Question 87 Mn the UML notation, pa!amete!i$ed &gene!ic' classes a!e !ep!esented b#4 a. the no!mal class !ep!esentation with a dotted a!!ow pointing at the template pa!amete! classes b. the no!mal class !ep!esentation but shaded g!e#. c. the no!mal class !ep!esentation with a dotted outline and the names of its pa!amete! classes listed on the top !ightDhand co!ne!. d. the no!mal class !ep!esentation with a !ectangula! bo+ in its top leftDhand co!ne!. Question :- Mnhe!itance !elationships a!e !ep!esented in the UML notation b#4 a. nesting of classes b. lines with a solid diamond at one end c. lines with a hollow diamond at one end d. lines with a t!iangula! a!!ow at one end e. lines with a t!iangula! a!!ow at both ends Answer Keys: 1.b %.d 3.b 8.a :.d <.c B.d 6.b 7.a 1-.a 11.a 1%.a 13.d 18.d 1:.1--,77 1<.3 1B.8 16.8 17.3 %-.1 %1.1 %%.8 %3.1 %8.8 %:.3 %<.1 %B.8 : < B 6 7 1- %6.1 %7.1 3-. D1 D1 31.a 3%.d 33.a 38.a,f 3:. b 3<.a 3B.b,d 36.a 37.b 8-.c 81.a 8%.a 83.b 88.b 8:.d 8<.b 8B.c 86.b,c 87.c :-.d