Consider a three-dimensional arrayint[] numbers = new int[101010].If this array were to be looped through using for-each loops, what type of variable must be declared in the outermost loop?
  • int
  • int[]
  • int[]
  • int[]
Consider two classes class ChessPiece and class King extends ChessPiece. Suppose King has a method getChecked() that is not found in the super class.Which of the following can be used with ChessPiece cp to access the getChecked() method?
  • ((King)cp).getChecked()
  • (King)(cp).getChecked()
  • (King)cp.getChecked()
  • ((King)cp.getChecked())
Consider a two-dimensional arrayint[] grid = new int[88]. Which of these for loops will iterate only through the elements on the diagonal from grid[53] to grid[71]?
  • for(int i = 5, j = 3; i <= 7 && j >= 1; i++, j--)
  • for(int i = 5; i<= 7; i++)for(int j = 3; j >= 1; j--)
  • for(int i = 5, j = 3; i <= 7 || j >= 1; i++, j--)
  • for(int i = 5 && j = 3; i <= 7 && j >= 1; i++ && j--)
Consider an array int[] grid = new int[88]. Given two arbitary indices x and y, which of the following for loops will iterate through the 3x3 region centered on (x,y) without ever throwing an ArrayIndexOutOfBoundsException?
  • for(int i = Math.max(0,x-1); i <= Math.min(7,x+1); i++)for(int j = Math.max(0,y-1); j <= Math.min(7,y+1); j++)
  • for(int i = Math.max(0,x-1), j = Math.max(0,y-1); i <= Math.min(7,x+1) && j <= Math.min(7,y+1); i++, j++)
  • for(int i = Math.min(0,x-1); i <= Math.max(7,x+1); i++)for(int j = Math.min(0,y-1); j <= Math.max(7,y+1); j++)
  • for(int i = Math.min(0,x-1), j = Math.min(0,y-1); i <= Math.max(7,x+1) && j <= Math.max(7,y+1); i++, j++)
Consider two classes class ChessPiece and class Knight extends ChessPiece. Suppose ChessPiece and Knight have the same method getMoveset().If Knight k = new Knight(), which of the following is executed when calling k.getMoveset()?
  • Knight.getMoveset(), then ChessPiece.getMoveset()
  • ChessPiece.getMoveset(), then Knight.getMoveset()
  • Knight.getMoveset()
  • ChessPiece.getMoveset()
Which of the following interfaces is used to implement mouse click functionality?
  • MouseAdapter
  • MouseListener
  • MouseMotionListener
  • MouseWheelListener
0:0:1



Answered

Not Answered

Not Visited
Correct : 0
Incorrect : 0