Font size
WorksheetsGr 10 Term 2 Final Exam
Total questions: 51
Worksheet time: 34mins
public class MyClass {
public static void main(String args[]) {
int x=10;
int y=25;
int z=x+y;
int j= y-x;
int gaith = y*x;
int khalid = y/x;
System.out.println("Sum of x+y = " + z);
System.out.println("difference of xy = " + j);
System.out.println("product of xy = " + gaith);
System.out.println("division of xy = " + khalid);
}
}
Sum of x+y = 35
division of xy = 2
Sum of x+y = 35
difference of xy = 15
Sum of x+y = 35
difference of xy = 15
product of xy = 250
division of xy = 2
product of xy = 250
division of xy = 2
The values involved in any mathematical operations are known as ____________
Operators
Operands
Symbols
Tokens
&& operator will return true value only if both the relational expressions involved returns the value
true
false
both
none of the above
The output of the following statements will be
int a = 14; b= 4;
boolean x=(a>b)? true:false
true
false
error
none of the above
int x = 10;
x = x + 5;
System.out.println(x);
What will be the output?
15
5
55
x5
int x = 4.4;
int y = 5.5;
System.out.println(x == y);
What will be the output?
4.4
true
false
5.5
arithmetic operators return a value. True or false?
true
false
which description of these relational operators are incorrect?
==(equal to)
<(less than)
>=(greater than)
!=(less than equal to)
What is the operator used for division in Java?
*
+
_
/
What is the operator used for multiplication in Java?
%
*
_
+
What is the operator used for subtraction in Java?
+
*
_
/
What does the modulo operator % do in Java?
Computes the product
Computes the quotient
Computes the sum
Computes the remainder
Which operator is used to assign values to variables in Java?
&
*
=
+
What do relational operators do in Java?
Check whether an expression is true or false
Assign values to variables
Perform arithmetic operations
Check the relationship between two operands
What is the purpose of logical operators in Java?
To compute the remainder
To assign values to variables
To check the relationship between two operands
To check whether an expression is true or false
Which operator is used for addition in Java?
*
+
%
=
Which operator is used to compare two values in Java?
&
*
==
+
What does the '&&' operator do in Java?
Performs logical AND operation
Performs logical OR operation
Performs logical NOT operation
Performs logical XOR operation
Operators are symbols that perform operations on variables and values.
True
false
_________ are symbols that perform operations on variables and values.
Operators
Variable
datatype
value
Identify the given java operators
Arithmetic
Assignment
Logical
Relational
Identify the given java operators
Arithmetic
Assignment
Logical
Relational
Identify the given java operators
Arithmetic
Assignment
Logical
Relational
Identify the given java operators
Arithmetic
Assignment
Logical
Relational
Which of these are Operators in Java
Arithmetic Operators
Assignment Operators
Relational Operators
Logical Operators
Variable
______ operators are used to perform arithmetic operations on variables and data such as * / % - +
arithmetic
logical
relational
Assignment
__________operators are used in Java to assign values to variables. i=5
Arithmetic
Assignment
Logical
Relational
Which of these is a identified as Assignment operator
+
=
>
&&
int a = 7;
int b = 2 + a;
b = 9
b = 2
b = 7
b = 5
What will print?
System.out.println( 4 / 2 );
2
0.25
1
4
int x = 4;
x * 10;
Which will be the value now?
x is now 40
x is now 10
x is still 4
x is now 14
Which of these are operators? + - X /
Arithmetic operators
Variables
datatypes
None of these
int a = 10;
int b = 20;
int c = a+b;
System.out.println("Addition = "+c);
10
20
30
40
int a = 10;
int b = 20;
int c = a*b;
System.out.println("Multiply = "+c);
10
120
30
40
int a = 20;
int b = 10;
int c = a/b;
System.out.println("division = "+c);
2
120
30
40
int a = 20;
int b = 10;
int c = a- b;
System.out.println("Subtraction = "+c);
2
120
10
40
--------- is a symbol, that operates on operands and produce a result
operands
variables
operators
Ternary
Choose 2 OPTIONS FOR logical operators
And
Less than
OR
Not Equal
What is the result of 13<=13 ?
True
False
Both true and false
None
The result of AND operator is always true, if both the conditions results are _____
True
False
in Java every statement is end with _____?
Comma
Colon
Semicolon
Brace
Java is case sensitive language.
True
False
________are symbols that perform operations on variables and values.
Variables
values
Operators
Literals
________operators are used to perform arithmetic operations on variables and data.
Arithmetic Operators
Assignment Operators
Relational Operators
Logical Operators
________________ operators are used in Java to assign values to variables
Arithmetic Operators
Assignment Operators
Relational Operators
Logical Operators
________operators are used to check the relationship between two operands
Arithmetic Operators
Assignment Operators
Relational Operators
Logical Operators
____________________operators are used to check whether an expression is true or false.
Arithmetic Operators
Assignment Operators
Relational Operators
Logical Operators
If a=2, b=5, c=3
Find result for : 8 * (a + b + c) – a % c
80
81
77
78
What would the new value of A be?
A= 1+0
1
2
3
4
