public class TestWhile {
public static void main(String[] args)
{
int i = 1;
int j = 20;
int k = 31;
while (i < j) {
k += (i * j);
i = i * 2;
j--;
}
System.out.println("i = " + i + " j = " + j + " k = " + k);
}
}
Break the fear
Quiz
•
Computers
•
11th - 12th Grade
•
Hard
spondon ganguli
Used 5+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class TestWhile {
public static void main(String[] args)
{
int i = 1;
int j = 20;
int k = 31;
while (i < j) {
k += (i * j);
i = i * 2;
j--;
}
System.out.println("i = " + i + " j = " + j + " k = " + k);
}
}
i = 15 j = 13 k = 759
i = 16 j = 16 k = 297
i = 11 j = 10 k = 801
i = 15 j = 13 k = 808
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class GotIt
{
public static void main(String[] argss)
{
int m = 0;
while (m++ < 2)
System.out.print(m + " ");
}
}
0 1 2
1 2
2
1
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class HarmonicSeries
{
public static void main(String args[])
{
int num = 5;
double result = 0.0;
while (num > 0)
{
result = result + (double) 1 / num;
num--;
}
System.out.println(result);
}
}
2.2833
1.8
0
1.0
4.
FILL IN THE BLANK QUESTION
1 min • 1 pt
public class A {
public static void main(String[] args)
{
System.out.println('j' + 'a' + 'v' + 'a');
}
}
What will be the output of the above code?
5.
FILL IN THE BLANK QUESTION
1 min • 1 pt
public class Demo{
public static void main(String[] arr){
Integer num1 = 100;
Integer num2 = 100;
Integer num3 = 500;
Integer num4 = 500;
if(num1==num2){
System.out.print("num1 == num2");
}
else{
System.out.print("num1 != num2");
}
if(num3 == num4){
System.out.print("num3 == num4");
}
else{
System.out.print("num3 != num4");
}
}
}
Above code will give ______ output.
6.
FILL IN THE BLANK QUESTION
1 min • 1 pt
class Input_Output
{
public static void main(String args[]) throws IOException {
char c;
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
do
{
c = (char) obj.read();
System.out.print(c);
} while(c != 'q');
}
}
What will be the output of the following Java program if input given is ‘abcqfghqbcd’?
7.
FILL IN THE BLANK QUESTION
1 min • 1 pt
__________ is used to perform all input and output operations in Java.
10 questions
Representing and understanding algorithms
Quiz
•
10th - 11th Grade
11 questions
Method Review II
Quiz
•
12th Grade
6 questions
AP CSA 5.4 / 5.5 (Getters / Setters)
Quiz
•
10th - 12th Grade
12 questions
week 1 basic java coding language
Quiz
•
9th - 12th Grade
10 questions
Python Data Types
Quiz
•
9th - 12th Grade
7 questions
Programmēšana I ievads
Quiz
•
12th Grade
15 questions
Functions in Python
Quiz
•
9th - 12th Grade
14 questions
Computing Revision JCG
Quiz
•
KG - University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
17 questions
Parts of Speech
Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University