Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the value of str after the following code has been executed? String str;

ID: 3573413 • Letter: W

Question

What is the value of str after the following code has been executed? String str; String sourceStr - "Hey diddle, diddle, the cat and the fiddle"; str = sourceStr.substring(12, 17);, didd diddl Iddle diddle "smiles"substring(1, 5) returns "mile". true false If str is declared as: String str = ÄBCDEFGHI"; What will be returned from Character. toLowerCase(str.charAt(5))? F e f E The statement is used to make simple decisions in Java branch for do/while if A Boolean expression is one that is either: X or Y Positive or negative true or false None of the above Which of the following expressions will determine whether x is less than or equal to y? x >= Y x = y x y) x = x - y; 135 75 15 60 This is a control structure that causes a statement or group of statements to repeat. Body Prefix mode Loop Block The increment operator is: -- -= ++ *= This type of loop is ideal in situations where the exact number of iterations is known. Do-while loop for loop if statement while loop The switch statement is a: Sequence structure Multiple alternative decision structure Nested decision structure Test expression

Explanation / Answer

22)
String str;
String sourceStr = "Hey diddle, diddle, the cat and the fiddle";
str = sourceStr.substring(12,17);

// sourceStr.substring(m,n) --> sourceStr[m,n-1] i.e, from index m to (n-1)th index (including) so,
// str = diddl

23) "smiles".substring(1,5) = "smiles"[1,4] --> mile --> True

24)
   String str = "ABCDEFGHI";
   Character.toLowerCase(str.CharAt(5));
   // Gives lowercase letter of str at 5th index
   // So, Output will be, str[5] --> f

25)
   if statement is used to make simple decisions in Java. like = > < etc.

26)
   A boolean expression is one that is either : True or False

27)

   x is less than or equal to y : x<=y

28)
   int x = 75;
   int y = 60;
   if(x > y)       // x>y true
       x = x-y;   // x = 75-60 = 15
   // so x = 15

29)
   Loop : is a control structure that causes a statement or group of statements to repeat.

30)
   The increment operator is : ++

31)
   for loop : is ideal in situations where the exact number of iterations is known.

32)
   switch statement is : Multiple alternative decisions.

  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote