COMP 1210 Exam 2 004 - Spring 20 Exam 2 — some“ —...

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: Spring 20]] Exam 2 — some“ — Page 4 of T 1?. Suppose that a method in the Compute class checks the lenglh of a String fonnal parameter. iii-“hat in ~. ' ' type of relationship exists belween the Compute class and String class? / .? aggregation ‘ eP-mac ,- e. inheritance {If "- new general dapendency u E3. What value does ricker hold after the following code is executed ifprianol'ae is equal to 6'? double ticket = 2: switchlprintlfialue} { case 6: oase- 8: ticket += 2: ’4. case 10: ticket += 3; 1 break: default: tic'set += E1; @- } . a. 2.0 by“) e. 5.0 ti?) e. 10.0 l9. Suppose that names is an array ofstrings Lad deposits is an ArrayList of double values. Which of the following expressions results in a value of true if names contains the same number of elements as deposits? a names.length =L deposits.length b. names.size[l == deposits.sizell E names.length —— deposit5.siae[l names.size[l == deposits.length e. The two cannot be eornpared with resla-ect 10 size 20. Which of the following ArravList objects can only contain Name objects? a ArrayList o = new ArrayListl}; fig) ArrayListcttame> 'o = new ArrayListcflarne>llr o flrrayListcName> c = new Name; :1. Array-Listt tiring} cl = new ArrayListCNameHl; e. ArrevList<StringJ> e = new ArrayListlJcNomo>= 2|. What is the value ofrheResair afier the following code is executedlfi kill: theResult = 6.4 :> 3.2 as. U: sa 'a‘ != 'A' as 1']; 2+. .'< 5; a. 6.4 h. 3.2 K. H‘ d. 'a' e; false 22. The variables (:1th and here are both declared as char values. Which oflhe following expressions evaluates to true if alpha and hem hold the same value?I a. a 113-313 . compareTo [beta] h. alpha.equals[bet;] [El alpha == bets d. alpha 1' beta e. char values cannot be compared to each other ...
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