Casting
Incrementing
Trace the Value
Terminology
Errors
100

Convert to double:

int num = 10;

double data = num;

//To covert into double you'd have to assign to new variable

100

What is the value of newNum and of i when:

int i = 10;

int newNum = 10 * i;

 i= i + 1;

    

i= 11

newNum= 100

100

What is the value of item when:

item= item+5;

the value of item would be 5

100

int, double, and String are _____ 

data types

100

Public Static Void Main (String [] args){

}


Syntax error, main method.

public static void main (String [] args){

}

200

When converting from int to double, are you widening the range or narrowing the range?

You are widening the range.

Remeber that double has a bigger range (biggest overall) than integer.

200

What is the value of a,b, and c:

int a=11, b=22, c;

c = a + b + a+  b +a +b;

a=11

b=22

c=99

200

what is the value of:

5/2

This is integer division so the answer would be 2 instead of 2.5

200

what are the two ways to divide in java?

Explain what they do

/ and the %

200

int x = 4/0; 

Runtime/compile error. 4 divided by 0 will throw an Arithmetic exception


300

Convert to int:

double num = 10.99;

int data = (int)num;

Will have to assing to a new variable.

300

int m = 0,  n = 1;

m++;

n+=2;

System.out.println(m);

System.out.println(n);

m= 1

n= 3


300

what is the value of --> int value= 100%5

0 because the % gives you the remainder of a division

300

a ___ is called the assignment operator because it's used to assign a value to a variable.

the = sign

300

int div = x/2; 

int x= 1; 

yes this is a compile time error


400

When converting from double to int, are you widening the range or narrowing the range?

You are narrowing the range; interger is smaller than double

400

What is the value of p?

int m = 0, n = 1;

int p = m++ * n++;

System.out.println(p);

      

The value of p is 0

Because p take the original values of m and n:

so the problem is actually 0*1


400

What is the value of z when :

int y=+ 5;

int z= y%2;

First 5 is assigned to y,

then y (which is 5) is divided by 2 and since it uses the % method it would only indicate if there is a remainder. 

When their is remain it is show as a 1(for int division)

400

A ______  is known as a final variable

constant

400

int m = 6, sum; 

double r=3.4; 

sum = m+r; 

System.out.println(sum); 

yes this is a logic error, since it gives an inaccurate answer.

500

Can you convert an integer data type into a String data type?

Yes.

Java can convert Int to String Using the ToString Method

500

int a = 6; int b = a++;

System.out.println(a);

System.out.println(b);

a = 6; b = ++a;

System.out.println(a); System.out.println(b);

a=7

b=6

a=7

b=7

500

what is the value of: 

byte b = 1000

Wouldn't be able to be assign because this value is too large for this data type; would cause a compile error 

500

What data type has the largest storage size?

Double

M
e
n
u