- Science
- Computer Science
-
Flashcards
-
Learn
-
Test
-
Match
-
Flashcards
-
Learn
-
Test
-
Match
Terms in this set (25)
Recommended textbook solutions
COMPUTER SCIENCE
Consider the following methods. public void modParams(int[] x, int[] y, String[] s) { x[1]=5; y=x; s[1]=new String("five"); s=new String[3]; s[1]=new String("six"); } public void print() { int[] a={1, 2, 3}; int[] b={11, 22, 33}; String[] s={"one", "two", "three"}; modParams(a, b, s); System.out.println(a[1]+" "+b[1]+" "+s[1]); } What is printed when print is called? (A) 2 22 two, (B) 5 22 two, (C) 5 5 two, (D) 5 22 five, (E) 5 5 six.
Verified answer
COMPUTER SCIENCE
Verified answer
COMPUTER SCIENCE
The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values and goes from a force of 0, which is no wind, up to 12, which is a hurricane. The following script first generates a random force value. Then, it prints a message regarding what type of wind that force represents, using a switch statement. You are to rewrite this switch statement as one nested if-else statement that accomplishes exactly the same thing. You may use else and/or elseif clauses. ranforce = randi([0, 12]); switch ranforce case 0 disp('There is no wind') case {1,2,3,4,5,6} disp('There is a breeze') case {7,8,9} disp('This is a gale') case {10,11} disp('It is a storm') case 12 disp('Hello, Hurricane!') end
Verified answer
COMPUTER SCIENCE
Verified answer
Other Quizlet setsRelated questions