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?
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;
}
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);
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);
}
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
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