java operators

Quiz
•
Computers
•
University
•
Hard
learn new
Used 25+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class OperatorExample{
public static void main(String args[]){
int x=10;
System.out.println(x++);
System.out.println(++x);
System.out.println(x--);
System.out.println(--x);
}}
10 12 12 10
11 12 11 10
10 11 10 9
11 12 12 11
Answer explanation
//10 (11)
//12
//12 (11)
//10
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class OperatorExample{
public static void main(String args[]){
int a=10;
int b=10;
System.out.println(a++ + ++a);
System.out.println(b++ + b++);
}}
20 20
20 22
22 21
21 22
Answer explanation
//10+12=22
//10+11=21
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class OperatorExample{
public static void main(String args[]){
int a=10;
int b=-10;
boolean c=true;
boolean d=false;
System.out.println(-a);
System.out.println(-b);
System.out.println(!c);
System.out.println(!d);
}}
-10 -9 true false
-11 9 false true
-11 -9 true false
-10 9 false true
Answer explanation
//-11 (minus of total positive value which starts from 0)
//9 (positive of total minus, positive starts from 0)
//false (opposite of boolean value)
//true
}}
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class OperatorExample{
public static void main(String args[]){
System.out.println(10*10/5+3-1*4/2);
}}
11
3
10
21
Answer explanation
according to boadmas rule priority
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
public class OperatorExample{
public static void main(String args[]){
System.out.println(10<<2);
System.out.println(10<<3);
System.out.println(20<<2);
System.out.println(15<<4);
}}
40 80 80 240
20 30 40 60
8 9 18 11
5 3.3 10 3.75
Answer explanation
//10*2^2=10*4=40
//10*2^3=10*8=80
//20*2^2=20*4=80
//15*2^4=15*16=240
}}
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public OperatorExample{
public static void main(String args[]){
System.out.println(10>>2);
System.out.println(20>>2);
System.out.println(20>>3);
}}
20 40 60
40 80 160
2 5 2
10 20 23
Answer explanation
//10/2^2=10/4=2
//20/2^2=20/4=5
//20/2^3=20/8=2
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class OperatorExample{
public static void main(String args[]){
int a=10;
int b=5;
int c=20;
System.out.println(a<b&&a<c);
System.out.println(a<b&a<c);
}}
true true
false false
true false
false true
Answer explanation
//false && true = false
//false & true = false
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Java Programming Basics

Quiz
•
University
10 questions
Milestone 1 - Assignments, Expression, Operators

Quiz
•
University
12 questions
kotlin Quiz 2

Quiz
•
University
10 questions
Wipro-inheritance

Quiz
•
University
10 questions
Java quiz 1

Quiz
•
University
10 questions
Latihan1

Quiz
•
University
15 questions
Java Quiz based on array

Quiz
•
University
15 questions
Trắc nghiệm kiến thức Java Core - Phần I

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University