eecs280sp13_MidtermExam

4 5 fritx0y0x ony010 di0wiei ohl dwie151 ohl frcai1i

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tcrl hs n t ra; / o’ iceti 1. 2. 3. 4. *t+; pr+ (pr+; *t)+ *+t; +pr +*t; +pr 1.c) Which of these code snippets cause an infinite loop? Consider integer overflow as an “infinite loop”. Circle 0 or more. 1. 2. 3. 4. 5. fritx=0 ;y< 0;+x; o(n ,y=0 =10 +) d i=0}wiei+; o{ ; hl(+) d }wie15!1; o{ hl(%&­) frca ;i<1;­i; o(hri=0 0 ­) vi uccl( odfn_al) {fn_al) uccl(;} 1.d) On which lines of the following code snippet will a compile error occur? Circle 0 or more. 1. 2. 3. 4. 5. 6. ita=2 n ; dul ; obeb=4 dul pr=&; obe*t a it& ; n c=b *t ; pr=5 dul pr (pr; obe*t2=*&t) EECS 280 Spring 2013 4/15 uniqname: _________________________ 1.e) Which of the following statements are true? Circle 0 or more. 1. Indexing off the end of an array will always cause a segmentation fault. 2. When a pointer is used as a function argument, it must be passed by reference. 3. If p r is of type c n t * i t p r cannot be re­assigned to. t os n, t 4. If p r is of type c n t * i t *p r cannot be re­assigned to. t os n, t 5. If a pointer is declared, but not initialized, it is a null pointer. 6. If a r is an array of length 5, the expression * a r + + 3 = a r 3 evaluates to r (r+ ) = r tu. re 1.f) Consider this recursive function: itsmRcrieitx n ) n oeeusv(n ,ity{ f( =0& =0 eun5 i x= &y= ){rtr ;} /sm eunln /oertr ie } Which of the following lines could replace "/ s m e u n l n " above and still keep /oertr ie the function tail recursive? Circle 0 or more. 1. r t r o e e u s v ( / , / ) + s m R c r i e x 2 y 2 ; eunsmRcriex2y2 oeeusv(/,/) 2. r t r o e e u s v ( / , s m R c r i e x 2 / ) ; eunsmRcriex2 oeeusv(/,y2) 3. i ( ) r t r o e e u s v ( / , y 2 l e r t r fx>0 eunsmRcriex5 /)es eun smRcriex5 /) oeeusv(/,y2; 4. r t r o e e u s v ( / , y 2 ; eun2+smRcriex2 /) 5. r t r o e e u s v ( / , s r ( ) 2 ; eunsmRcriex2 qty/) 1.g) Draw a line connecting the functions that could be assigned to the sam...
View Full Document

This test prep was uploaded on 03/10/2014 for the course EECS 280 taught by Professor Noble during the Winter '08 term at University of Michigan.

Ask a homework question - tutors are online