Game Preview

Revision 9

  •  English    21     Public
    java(bluej)
  •   Study   Slideshow
  • If a is of type int and b is of type float what would be the resultant data type of a+b?
    float
  •  5
  • Give one point of difference between unary and binary operators.
    Unary operator works on a single operand and Binary operator works on 2 operands
  •  10
  • Name the the types of conversion from one datatype to another
    implicit & explicit
  •  10
  • p=5 and q=19: int n = (q-p)>(p-q)?(q-p):(p-q);
    14
  •  10
  • y+=++y + y-- + --y; when int y=8
    33
  •  15
  • int a = 63, b = 36; boolean x = (a < b ) ? true : false; int y= (a > b ) ? a : b; Print x & y
    false & 63
  •  20
  • State the number of bytes occupied by char and int data types.
    char =2 , int =4
  •  10
  • Name the primitive data type in Java that is: a single 16-bit Unicode character whose default value is ‘\u0000’
    char
  •  5
  • The _______statement is used to avoid fall through
    break
  •  5
  • The __________ function of the Scanner class is used to accept a character from the user
    next().charAt(0)
  •  5
  • The while loop is an exit controlled loop
    false
  •  5
  • Name two jump statements
    return,break,coninue
  •  10
  • double num=Math.random(0); is a valid statement.
    false
  •  5
  • double a = - 6.35; double x = Math.abs(Math.ceil(a));
    6.0
  •  15
  • a=30, b=50; a = a + b; b = a – b; a = a – b; Print values of a & b
    50,30
  •  15
  • State one similarity between while and for loop.
    entry controlled loops
  •  5