Unformatted text preview:

MC Questions 1 b 2 c 3 b 4 c 5 a 6 d 7 d 8 b 9 c 10 a Q11 public class Vaccine private VirusStrain v1 v2 public Vaccine VirusStrain v1 VirusStrain v2 this v1 v1 this v2 v2 public VirusStrain getV1 return v1 public void setV1 VirusStrain v v1 v public VirusStrain getV2 return v2 public void setV2 VirusStrain v v2 v public int compareTo Vaccine other if v1 getStrength v2 getStrength other getV1 getStrength other getV2 getStrength return 1 else if v1 getStrength v2 getStrength other getV1 getStrength other getV2 getStrength return 1 else return 0 public String toString return v1 toString n v2 toString Q12 public class TestVaccines public static void main String args Vaccine vac new Vaccine 10 for int i 0 i 10 i VirusStrain v1 new VirusStrain H1N1 int Math random 10 1 VirusStrain v2 new VirusStrain Brisbane int Math random 10 1 vac i new Vaccine v1 v2 Vaccine strongest vac 0 for Vaccine v vac if v compareTo strongest 1 strongest v System out println v System out println strongest Q13 public static int firstFewOdds int numArray int target int result new int target int index 0 for int number numArray if number 2 1 result index number index if index target break if index target for int i index index target index result i 1 return result


View Full Document

NJIT CS 113 - MC Questions

Download MC Questions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view MC Questions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view MC Questions and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?