MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
When creating the array ‘scores(9)’, what does the ‘9’ in brackets represent?
A
The number of elements the array can hold
B
The largest number of digits an element can hold
C
The largest number of characters an element can hold
D
None of the above
Explanation: 

Detailed explanation-1: -The number in brackets determines how many data items the array can hold. The array score(9) would allow ten data items to be stored. Any facility that holds more than one item of data is known as a data structure. Therefore, an array is a data structure.

Detailed explanation-2: -2. What is the index number of the last element of an array with 9 elements? Explanation: Because the first element always starts at 0. So it is on 8 position.

Detailed explanation-3: -int baz [5] = ; This creates an array of five int values, each initialized with a value of zero: But, the elements in an array can be explicitly initialized to specific values when it is declared, by enclosing those initial values in braces .

Detailed explanation-4: -Array Initialization in Java To use the array, we can initialize it with the new keyword, followed by the data type of our array, and rectangular brackets containing its size: int[] intArray = new int[10]; This allocates the memory for an array of size 10 . This size is immutable.

Detailed explanation-5: -The position number contained within square brackets is more formally called a subscript (or index). A subscript must be an integer or an integer expression. If a program uses an expression as a subscript, then the expression is evaluated to determine the subscript.

There is 1 question to complete.