Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Late Objects
Quiz 4: Loops
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
Multiple Choice
What will be the output of the following code snippet? Boolean token = false; Do { System.out.println("Hello") ; } While (token) ;
Question 22
Multiple Choice
What is the output of the code snippet given below? String s = "12345"; Int i = 1; Do { If (i > 1) { System.out.print) ; } } While (i < 5) ;
Question 23
Multiple Choice
How many times does the following loop execute? Int upperCaseLetters = 0; String str = "abcdEfghI"; Boolean found = false; For (int i = 0; i < str.length() && !found; i++) { Char ch = str.charAt(i) ; If (Character.isUpperCase(ch) ) { Found = true; } }
Question 24
Multiple Choice
What is the result when the following code is run? Double x = 1; Double y = 1; Int i = 0; Do { Y = x / 2; X = x + y; I = i + 1; } While (x < 2.5) ; System.out.print(i + " ") ;
Question 25
Multiple Choice
Which of the following is the correct code snippet for throwing a pair of dice to get a sum of the numbers on two dice between 2 and 12 with different probabilities?
Question 26
Multiple Choice
What is the output of the following code snippet? Int i = 1; While (i <= 10) { System.out.println("Inside the while loop") ; I = i + 10; }
Question 27
Multiple Choice
Given the following code snippet, what should we change to have 26 alphabet characters in the string str? String str = ""; For (char c = 'A'; c < 'Z'; c++) { Str = str + c; }
Question 28
Multiple Choice
Which of the following activities can be simulated using a computer? I. Waiting time in a line at a restaurant II. Tossing a coin III. Shuffling cards for a card game
Question 29
Multiple Choice
What will be the range of the random numbers generated by the following code snippet? Int r1 = (int) (Math.random() * 50) + 1;
Question 30
Multiple Choice
What is the output of the following code snippet? Int i = 1; While (i < 20) { System.out.print(i + " ") ; I = i + 2; If (i == 15) { I = 19; } }
Question 31
Multiple Choice
What is the output of the code fragment given below? Int i = 0; Int j = 0; While (i < 125) { I = i + 2; J++; } System.out.println(j) ;
Question 32
Multiple Choice
What is the data type of the number generated by the Math.random() function?
Question 33
Multiple Choice
What is the output of the code snippet given below? String s = "abcde"; Int i = 1; Do { If (i > 1) { System.out.print) ; } } While (i < 5) ;
Question 34
Multiple Choice
What is the output of the code snippet given below? String s = "abcde"; Int i = 1; While (i < 5) { System.out.print) ; I++; }
Question 35
Multiple Choice
In the following code snippet, when does the execution of the program switch from the inner loop to the outer loop? Int i; Int j; For (i = 0; i <= 9; i++) { For (j = 1; j < 5; j++) { System.out.println("Hello") ; If (j == 2) { J = 6; } } }