Question
1.) Which of the following is a correct way to declare an int array. a.) int[] array; b.) int array; c.) int array[]; d.)Array[int] array
1.) Which of the following is a correct way to declare an int array.
a.) int[] array; |
b.) | int array; |
c.) | int array[]; |
d.)Array[int] array |
2.)Which of the following to is a correct way to declare and initialize an array of integers with length 10?
3.)Which of the following is a correct way to declare and initialize an array with values 1,2,3,4,5 ?
4)What is x[0] in the following code? int[ ] x = {1,2,3};
5)What type of data type would you create if a user wants to enter 50 names?
6)Will the following code compile or no? int[ ] x = new int[3]; x = {1,2,3};
7)Each element in the array is represented using the following syntax, known as an ________ , ________ .
8)You change a length of the array once it is initialized without reinitializing the array. True or False?
9)Look at the line of code below. Which of the following answer choices can be used to print the last element of array x? String[ ] x = {"Tom", "Bob", "Jerry", "Cat"}; Note that the last element is "Cat", and x.length returns the size of the array (in this case, 4). Also notice that we use x.length for arrays, while for Strings, it is someString.length().
11) How do you declare an array variable? (Write a code snippet.) Note that you aren't initializing anything yet, but simply declaring it?
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started