Telegram group: T.me/BBCNOUN ====== CIT341 ====== 1. What is the value of 3+4%6/2+5? 5 6 9 --->> 10 2. Which of the sets of statements below will add 1 to x if x is positive and subtract 1 from x if x is negative but leaves x alone if x is 0? if (x > 0) x++; else x--; --->> if (x > 0) x++; else if (x < 0) x--; if (x == 0) x = 0; else x++; x--; x++; x--; 3. Which of the following options is a valid declaration of an object of class Student? --->> Student person = new Student(); Person student = new Person(); Person student = new Student(); new student; 4. Which of the following loops will execute statements at least once, even when the condition is initially false? --->> do-while while for do-while, while 5. What is the logical representation of the expression “A is from 70 to 100 inclusive” 70 >=A<= 100 70<= A <= 100 A>=70 || A <= 100 --->> A>=70 && A <= 100 6. Given that int x, y; and that x < y what is the value of x % y? --->> x y x-y y-x 7. What should be expr1 be evaluated to in the following ternary operator? expr1 ? expr2 : expr3 --->> Integer Floating – point numbers Boolean String 8. Of the following conditional statements, which one correctly executes three instructions if the condition is true? if (x < 0) a = b * 2; y = x; z = a – y; { if (x < 0) a = b * 2; y = x; z = a – y; } if{ (x < 0) a = b * 2; y = x; z = a – y ; } --->> if (x < 0) { a = b * 2; y = x; z = a – y; } 9. Which of the following best describe the functionality of a break statement? Break stops the execution of entire program --->> Break halts the execution and forces the control out of the loop Break is used to replace if statement Break jumps to the next statement 10. What is the final value of y after the execution of the statements: int x = 20, y=10; y = (x < 50) ? x : 5; Y=5 Y=4 Y=10 --->> Y=20