CSE 205 midterm UPDATED ACTUAL EXAM QUESTIONS
AND CORRECT ANSWERS
Question 1.
In Java, functions are called ___.
ANSWER
Methods
Question 2.
We can use a variable as an index expression to access an array element in Java.
ANSWER
True
Question 3.
Java uses the ^ (caret) operator for exponentiation.
ANSWER
False
Question 4.
In Java parameter variables must be declared with their data type.
ANSWER
True
Question 5.
Method overloading distinguishes between methods based on _____.
ANSWER
both
number of arguments
and
data types of arguments
, Question 6.
In Java, arrays can only store primitive types.
ANSWER
False
Question 7.
Which of the following correctly demonstrates the use of an array initializer list?
ANSWER
Int[] my_array = {1, 2, 3, 4, 5};
Question 8.
Which of the following is/are true about arrays? Choose all that apply.
ANSWER
the elements of an array all located contiguously in memory an array is a set of variables
the elements of an array are accessed by an integer index the elements of an array all have the
same data type
Question 9.
Java arrays have an attribute named _____ that can be accessed to get the size (number of elements) of
the array.
ANSWER
Length
Question 10.
We cannot delete individual elements from an array in Java.
ANSWER
True
Question 11.
Arrays cannot be passed as arguments to methods in Java.
ANSWER
False
AND CORRECT ANSWERS
Question 1.
In Java, functions are called ___.
ANSWER
Methods
Question 2.
We can use a variable as an index expression to access an array element in Java.
ANSWER
True
Question 3.
Java uses the ^ (caret) operator for exponentiation.
ANSWER
False
Question 4.
In Java parameter variables must be declared with their data type.
ANSWER
True
Question 5.
Method overloading distinguishes between methods based on _____.
ANSWER
both
number of arguments
and
data types of arguments
, Question 6.
In Java, arrays can only store primitive types.
ANSWER
False
Question 7.
Which of the following correctly demonstrates the use of an array initializer list?
ANSWER
Int[] my_array = {1, 2, 3, 4, 5};
Question 8.
Which of the following is/are true about arrays? Choose all that apply.
ANSWER
the elements of an array all located contiguously in memory an array is a set of variables
the elements of an array are accessed by an integer index the elements of an array all have the
same data type
Question 9.
Java arrays have an attribute named _____ that can be accessed to get the size (number of elements) of
the array.
ANSWER
Length
Question 10.
We cannot delete individual elements from an array in Java.
ANSWER
True
Question 11.
Arrays cannot be passed as arguments to methods in Java.
ANSWER
False