In java -
Question 5 (Which CASE? - 10 pts) – What is the output of the following code?
CREATE x <-- 5
SWITCH (x) C
ASE 1: PRINTLINE (“hello world”)
BREAK
CASE 2: PRINTLINE (“hELLO wORLD”)
CASE 3: PRINT (“HELLO WORLD”)
BREAK
CASE 4: PRINTLINE(“Hello”)
CASE 5: PRINT(“World”)
BREAK
DEFAULT: BREAK
public class SwitchCase {
public static void main(String[] args) {
int x = 5;
switch (x) {
case 1:
System.out.println("hello world");
break;
case 2:
System.out.println("hELLO wORLD");
case 3:
System.out.println("HELLO WORLD");
break;
case 4:
System.out.println("Hello");
case 5:
System.out.println("World");
break;
default:
break;
}
}
}


World
In java - Question 5 (Which CASE? - 10 pts) – What is the output of...
PLEASE DO THIS IN PYTHON!! Question 5 (Which CASE? - 10 pts) – What is the output of the following code? CREATE x <-- 5 SWITCH (x) CASE 1: PRINTLINE (“hello world”) BREAK CASE 2: PRINTLINE (“hELLO wORLD”) CASE 3: PRINT (“HELLO WORLD”) BREAK CASE 4: PRINTLINE(“Hello”) CASE 5: PRINT(“World”) BREAK DEFAULT: BREAK
PSUEDOCODE ONLY!! What is the output of the following code? CREATE x 1 SWITCH (x) Print output here: Print output here: BREAK CASE 2: PRINTLINE (“hELLO wORLD”) CASE 3: PRINT (“HELLO WORLD”) BREAK CASE 4: PRINTLINE(“Hello”) CASE 5: PRINT(“World”) BREAK DEFAULT: BREAK
all
in pseudocode
Question 1) Warmup question: Write a function named True False() (only the function, no main is needed) that takes in a number and determines if it is evenly divisible by 5 (le, returns true or false). (15 points) Answer is in: Pseudocode CHO Java0 C+0 Page 17 Question 3) 2D Arrays The IRS has contracted you to process a 10x10 array of floating point numbers called Taxes and sum up all negative numbers in the array so...
need help with java questions
The following snippet of code would produce what outcome? public static void main(String 2 [] args) { int day = 5; switch (day) { case 1: System.out.println("Monday "); case 2: System.out.println("Tuesday "); case 3: System.out.println("Wednesday "); case 4: System.out.println("Thursday "); case 5: System.out.println("Friday "); case 6: System.out.println("Saturday "); case 7: System.out.println("Sunday "); break; default: System.out.println("Invalid Day "); } } Invalid Day Friday Saturday Sunday Invalid Day Friday Friday Saturday Sunday What will be the output...
Question 5: Consider the following C++ program. switch(x) case 1: if (x > 1) case 2: if (x > 3) case 3: cout<<"Epic Beats!" << endl; case 4: cout << "Chill Vibes" << endl; break; case 5: cout << "Sweet Jazz" << endl; break; default: cout << "Invalid input. Try again."; A. What is the output if x = 1? B. What is the output if x = 3? C. What is the output if x = 2? D. What...
Please try to explain the answers as well. It will be highly appreciated. Output of the following expression: 5 * 4 % 2 = ? Output of a loop: Example: What will be the output of the Java code (Assume all variables are properly declared.) num = 10; while (num <= 32) num = num + 5; System.out.println(num); What will be the output of the Java code (Assume all variables are properly declared.) public class test { ...
1. What would be the output of the following lines of code: int num = 2; switch(num){ case 1: cout << "1"; case 2: cout << "2"; case 3: cout << "3"; case 4: cout << "4"; } 2. What would be the output of the following code: char op = '*'; switch(op){ case '+': cout << "Addition"; break; case '-': cout << "Subtraction"; break; case '/': cout << "Division"; break; default: cout << "Invalid"; } 3. What would be...
Question 5 (1 point) userGuess ← 0, secretNumber ← 5 PRINT “Enter a number between 1 and 10” READ userGuess WHILE (userGuess < 1 OR userGuess > 10) PRINTLINE “That is not between 1 and 10. Try again.” READ userGuess ENDWHILE IF (userGuess == secretNum) THEN PRINTLINE “That’s right! ”, userGuess, “ is the secret!” ELSE PRINTLINE userGuess, “ is not the secret!” ENDIF What is the first WHILE loop being used for? Question 5 options: Input validation Random number...
20) What is the output of the following segment of C code: int avg(int n, int* a); int main () { int array[4]={1,0,6,9}; printf("%d", avg(4, array)+ 1); system("pause"); return 0; } int avg(int n, int* a) { int i, sum=0; for (i=0;i<n;i++) { sum+=a[i]; } return sum/n; } a) 16 b) 5 c) 4 d) 8 21) What is the output of the following segment of C code: int x = 2; int y = 3;...
1. In java (What is the output of the code segment)? public static void Main(){ int x = 38; int y = 45; int z = DoIt(ref x, ref y); PRINTLINE(x + “ “ + y + “ “ + z); // PRINTLINE 1 } static int DoIt(ref int a, ref int b) { a /= 6; b /= 8; PRINTLINE(a + “ “ + b); // PRINTLINE 2 return (a + b); } 2....