0% found this document useful (0 votes)
79 views

Questions On JAVA Arithmetic Operators: X X X X

The document discusses Java arithmetic operators. It contains 10 multiple choice questions that test understanding of: 1) Valid operands for arithmetic operators 2) Modulus operator and valid data types 3) Increment and decrement operators 4) Assignment operators 5) Output of programs using arithmetic operators

Uploaded by

Indumathy S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

Questions On JAVA Arithmetic Operators: X X X X

The document discusses Java arithmetic operators. It contains 10 multiple choice questions that test understanding of: 1) Valid operands for arithmetic operators 2) Modulus operator and valid data types 3) Increment and decrement operators 4) Assignment operators 5) Output of programs using arithmetic operators

Uploaded by

Indumathy S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Questions on JAVA Arithmetic Operators

1. Which of the following can be operands of arithmetic operators?


a)Numeric
b)Boolean
c)Characters
d)Both-Numeric&Characters

2. Modulus operator, %, can be applied to which of these?


a)Integers
b)Floating–point-numbers
c)Both-Integer-and-floating–point-numbers
d)None-of-the-mentioned

3. With x = 0, which of the following are legal lines of Java code for changing the value
of x to 1?
1. x++;
2. x = x + 1;
3. x += 1;
4. x =+ 1;

a)1,2&3
b)1&4
c)1,2,3&4
d)3&2

4. Decrement operator, −−, decreases the value of variable by what number?


a)1
b)2
c)3
d)4

5.Which-of-these-statements-are-incorrect?
a) Assignment operators are more efficiently implemented by Java run-time system than
their-equivalent-long-forms
b)Assignment operators run faster than their equivalent long forms
c) Assignment operators can be used only with numeric and character data type
d)None-of-the-mentioned

6. What is the output of this program?

1. class increment
2. {
3. public static void main(String args[])
4. {
5. double var1 = 1 + 5;
6. double var2 = var1 / 4;
7. int var3 = 1 + 5;
8. int var4 = var3 / 4;
9. System.out.print(var2 + " " + var4);
10.
11. }
12. }

a)1””1
b)0””1
c)1.5””1
d)1.5””1.0

7. What is the output of this program?

1. class Modulus
2. {
3. public static void main(String args[])
4. {
5. double a = 25.64;
6. int b = 25;
7. a = a % 10;
8. b = b % 10;
9. System.out.println(a + " " + b);
10. }
11. }

a)5.640000000000001””5
b)5.640000000000001””5.0
c)5””5
d)5””5.640000000000001

8. What is the output of this program?

1. class increment
2. {
3. public static void main(String args[])
4. {
5. int g = 3;
6. System.out.print(++g * 8);
7. }
8. }

a)25
b)24
c)32
d)33

9. Can 8 byte long data type be automatically type cast to 4 byte float data type?
a)True
b)False

10. What is the output of this program?

1. class Output
2. {
3. public static void main(String args[])
4. {
5. int a = 1;
6. int b = 2;
7. int c;
8. int d;
9. c = ++b;
10. d = a++;
11. c++;
12. b++;
13. ++a;
14. System.out.println(a + " " + b + " " + c);
15. }
16. }

a) 3 2 4
b) 3 2 3
c) 2 3 4
d) 3 4 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy