CSE 110 - EXAM 3 QUESTIONS

Study Guides Aug 18, 2025
Loading...

Loading document viewer...

Page 0 of 0

Document Text

  • | Page

CSE 110 - EXAM 3 QUESTIONS

WITH 100% VERIFIED ANSWERS

Question : 1) 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?

a) System.out.println(somearray[28]);

b) System.out.println(somearray(28));

c) System.out.println(somearray(27));

d) System.out.println(somearray[27]);

CORRECT ANSWER : d

Question : Identify the correct statement for defining an

integer array named numarray of ten elements.

  • int[] numarray = new int[9];
  • int[] numarray = new int[10];
  • | Page
  • int[10] numarray;
  • int numarray[10];

CORRECT ANSWER : b

Question : Which one of the following statements is a

valid initialization of an array named somearray of ten elements?

  • int[] somearray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  • int somearray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  • int[10] somearray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  • int somearray[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

CORRECT ANSWER : a

Question : 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]);

  • 1050
  • 2030
  • 3040
  • | Page
  • 4050

CORRECT ANSWER : c

Question : 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]); }

a) The code snippet does not give any output.

b) The code snippet displays all the marks stored in the

array without any redundancy.

c) The code snippet causes a bounds error.

d) The code snippet executes an infinite loop.

CORRECT ANSWER : c

Question : What is the valid range of index values for an

array of size 10?

  • | Page
  • 0 to 10
  • 1 to 9
  • 1 to 10
  • 0 to 9

CORRECT ANSWER : d

Question : 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; }

a) The for loop initializes all the elements of the array.

b) The for loop initializes all the elements except the first

element.

c) The for loop initializes all the elements except the last

element.

Download Document

Buy This Document

$30.00 One-time purchase
Buy Now
  • Full access to this document
  • Download anytime
  • No expiration

Document Information

Category: Study Guides
Added: Aug 18, 2025
Description:

CSE 110 - EXAM 3 QUESTIONS WITH 100% VERIFIED ANSWERS Question : 1) Consider the following line of code: int[] somearray = new int[30]; Which one of the following options is a valid line of code fo...

Get this document $30.00