Previous QuizPrev Quiz
Arrays and Array Lists
Next QuizNext Quiz

Big Java Binder Early Objects

Computing

Quiz 7 :
Arrays and Array Lists

Quiz 7 :
Arrays and Array Lists

Showing 1 - 20 of 118
Next Quiz
arrow
Consider the following line of code: Int[] somearray = new int[30]; Which one of the following options is a valid line of code for displaying the twenty-eighth element of somearray?
Free
Multiple Choice
Answer:

Answer:

D

arrow
Identify the correct statement for defining an integer array named numarray of ten elements.
Free
Multiple Choice
Answer:

Answer:

B

arrow
Which one of the following statements is a valid initialization of an array named somearray of ten elements?
Free
Multiple Choice
Answer:

Answer:

A

arrow
What is the output of the following code snippet? Int[] myarray = { 10, 20, 30, 40, 50 }; System.out.print(myarray[2]); System.out.print(myarray[3]);
Multiple Choice
Answer:
arrow
What is the result of executing this code snippet? Int[] marks = { 90, 45, 67 }; For (int i = 0; i <= 3; i++) { System.out.println(marks[i]); }
Multiple Choice
Answer:
arrow
What is the valid range of index values for an array of size 10?
Multiple Choice
Answer:
arrow
Which one of the following statements is correct about the given code snippet? Int[] somearray = new int[6]; For (int i = 1; i < 6; i++) { Somearray[i] = i + 1; }
Multiple Choice
Answer:
arrow
What is the output of the given code snippet? Int[] mynum = new int[5]; For (int i = 1; i < 5; i++) { Mynum[i] = i + 1; System.out.print(mynum[i]); }
Multiple Choice
Answer:
arrow
Which one of the following statements is correct for the given code snippet? Int[] number = new int[3]; // Line 1 Number[3] = 5; // Line 2
Multiple Choice
Answer:
arrow
What is displayed after executing the given code snippet? Int[] mymarks = new int[10]; Int total = 0; Scanner in = new Scanner(System.in); For (int cnt = 1; cnt <= 10; cnt++) { System.out.print("Enter the marks: "); Mymarks[cnt] = in.nextInt(); Total = total + mymarks[cnt]; } System.out.println(total);
Multiple Choice
Answer:
arrow
When an array myArray is only partially filled, how can the programmer keep track of the current number of elements?
Multiple Choice
Answer:
arrow
Suppose you wish to write a method that returns the sum of the elements in the partially filled array myArray. Which is a reasonable method header?
Multiple Choice
Answer:
arrow
Which code snippet prints out the elements in a partially filled array of integers?
Multiple Choice
Answer:
arrow
In a partially filled array, the number of slots in the array that are not currently used is
Multiple Choice
Answer:
arrow
Complete the following code snippet with the correct enhanced for loop so it iterates over the array without using an index variable. String[] arr = { "abc", "def", "ghi", "jkl" }; ___________________ { System.out.print(str); }
Multiple Choice
Answer:
arrow
Which statements are true about the buffer overrun attack launched over the Internet in 1988? I) The buffer overrun exploited a program that was written in C running on the Unix operating system II) The Java programming language generates a run-time exception when buffer overrun occurs III) In recent years computer attacks have lessened
Multiple Choice
Answer:
arrow
What is the result of the following code? for (double element : values) { Element = 0; }
Multiple Choice
Answer:
arrow
Which statements about the enhanced for loop are true for arrays of primitve data? I) It is suitable for all array algorithms II) It does not allow the contents of the array to be modified III) It does not require the use of an index variable
Multiple Choice
Answer:
arrow
The enhanced for loop
Multiple Choice
Answer:
arrow
When the order of the elements is unimportant, what is the most efficient way to remove an element from an array?
Multiple Choice
Answer:
Showing 1 - 20 of 118
Next Quiz