{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

COMP 1210 Exam 2 003 - 121D GQJMP.1 1 Spring 20.11 Exam 2...

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

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

Unformatted text preview: 121D GQJMP .1 1 Spring 20.11 Exam 2 — 3f30f2011— Page 3 of"?if 1 2. What is printed after the following code is executed? Systnmlou:.printlni2‘3_§ || 2 d —5 ? “printl” : "print2"]; Q print] 4-1.“! ._ i '- h. printl c. '1’ printl d. 2 p1'int2 e. print] print2 13, Suppose that the static variable key {a deuble) is initialized to l and modified in on: constructor of the Account class given below: . 1. public: AccountEjnt in: g ' 5‘5} key — key "* id; } What is the value of key after the following code is executed? Account a1 = new AccounLiZ}: Account 512 = new Account [3}; Account 93 = new AccountiZ}; l 3 ? 12 A compile-time error occurs; key cannot be accessed .0 E}? .sr' .9 14. Suppose that The times array contains the 101101»ng values: [25 95 5i T: 37 7513; 4‘ 3:I What is the value ofrestdrVJI after the following code is executed? 3 4". int resultVal = Cl; C- "' ‘1? for {int 1 = 3; i <= 6; :i++J l 'l rtesulZVal +== times [i]; } a. 13 b. 15 c.2121. [1.22 ' e. 25 :- r'f _. .' _ 9"“ |. 15. What is the value of octane! afier the following code is executed? r int output. _= __Z; _ . . a“ output ='l__:!__<2 3 || 6 cc: 2 H [[B c: 10),“?! output. + 5 : output; .x -_ 3.43}; 13.3 c5 d? e.3 16. Which of following type declarations of merfnput would at cause a compile-time ermr if merinpm was used as an expression in a switch statement as below? switch tuserInput} a. double 1}. String @ char d. int :3. None ofthc above types would cause a compilatimc error ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern