Create Software Components 

Using Java Level 2

 

 

Course Info

Scheme

Resources

Tutorials

Java Demos

Utilities

Links


 

    Quiz 5

Operators & Expressions

There are 10 questions

Question 1.         

If x = 8 + 3 * 7 -1 what value does x store?

 

(a)   28

(b)   76

(c)   66

(d)   26

Question 2.         

What value does x store after execution of the following line?

 

x = 10 / 2 * 3 - 1;

 

(a)   10

(b)   14

(c)   2

(d)   2.5

Question 3.         

What value does num store after execution of the following line?

 

double num;

num = 10 / 2 * (3 - 10);

 

(a)   -35

(b)   35

(c)   14

(d)   2.5 

Question 4.         

What value does x store after execution of the following lines?

 

int x = 20;

x /= -5;

 

(a)   4

(b)   -4

(c)   -5

(d)  

Question 5.         

What value does rem store after execution of the following lines?

 

int rem;

rem = 10 % 7;

 

(a)   0

(b)   1

(c)   2

(d)  

Question 6.         

What value does i store after execution of the following lines?

 

int i = 0, j = 1;

i = j++;

 

(a)   0

(b)   1

(c)   2

(d)   3  

Question 7.         

What value does i store after execution of the following lines?

 

int i = 0, j = 1;

i = --j;

 

(a)   0

(b)   1

(c)   2

(d)   3  

Question 8.         

What value does ans store after execution of the following lines?

 

int i = 5;

float ans;

ans = 10 + i;

 

(a)   15

(b)   15.0

(c)   "10 + 5"

(d)   "15"  

Question 9.         

What value does ans store after execution of the following lines?

 

int ans;

float f = 5.3;

ans = 10 + (int)f;

 

(a)   15

(b)   15.0

(c)   "10 + 5"

(d)   "15"  

Question 10.         

What value does ch store after execution of the following line?

 

char ch;

ch = char(67);

 

(a)   'A'

(b)   'B'

(c)   'C'

(d)   'D'  

 

        

 

  Site Home 

Java Home   

  Forum  

Course Info

Welcome

Overview

Assessment

Qualification

Scheme of Work

Assignments

Resources

Information

Blackboard

Learning Center

Web Materials

Reading

Java Demos

Utilities

Links

Lecture Materials

Tutorials & Notes

Exercises

Activities

Quizzes

 

Site Home

Top

Unit Home

ADR 2002