Question

In: Computer Science

1 of 10 When declaring a jagged array, all dimensions must have the same type. True...

1 of 10

When declaring a jagged array, all dimensions must have the same type.

True
False

Question

2 of 10

What is the maximum number of dimensions you can declare for an array in C#?

3
10
5
There is no maximum.

Question

3 of 10

When you declare a two-dimensional array, you place two numbers within square brackets. What does the first number represent?

Class
Index
Column
Row

Question

4 of 10

When declaring a multidimensional array, all dimensions must have the same type.

True
False

Question

5 of 10

Given the code below, the variables "student1" and "student2" refer to the same memory location.

string student1 = "Student";
string student2 = "Student";

True
False

Question

6 of 10

The code below declares a jagged array.

int[][] jaggedArray = new int[2][];

jaggedArray[0] = new int[20];

jaggedArray[1] = new int[10];

int[0,10] = 95;
int[0][10] = 95;
int[1,11] = 95;
int[1][11] = 95;

Question

7 of 10

Given the code below, what is the output?

string student = " Student";

Console.WriteLine(student.Length)

7
Run-time exception
Compile-time exception
8

Question

8 of 10

Given the code below, what is the output?

string student1 = "Student";

string student2 = "Student";

if(student1 == student2)

{

    Console.WriteLine("True");

}

else

{

    Console.WriteLine("False");

}

True
False

Question

9 of 10

Select the output for the statement below.

int[,] examArray = new int[30, 6];
Console.WriteLine(examArray.GetLength(2));

A compilation error generates.
A run-time error generates.
6
30

Question

10 of 10

You can use multidimensional arrays to store a different number of columns for certain rows.

True
False

Solutions

Expert Solution

1) TRUE

jagged array means array of arrays and it may contain different dimensions but all must have same type

2) There is no maximum.

3) first number inside square brackets represents the rows

second number represents the columns

4) TRUE

In multi dimentional array all dimensions must be of same type.

5) TRUE

both student1 and student2 refers to same memory location.

6) int[][] jaggedArray = new int[2][];

this code will create jagged array with 2 rows

jaggedArray[0] = new int[20]; //this means first row will contain 20 elements

jaggedArray[1] = new int[10]; // second row will contain 10 elements

accessing& assigning array elements

jaggedArray[0][10]=95; -----> is the correct way of assigning

7) it gives output as 8

since student has 7 characters and there is space present before s letter , so totally 8

8) TRUE

since both objects refers to same memory location , therefore both are equal

9) Compilation error

it will give indexOutOfRange exception since the given array is 2-D i.e 0,1 .... but in getLength() it calls for 2 instead of 0 or 1.

10) TRUE

ex : int[][] arr=new int[5][10];

here arr has 5 rows and 10 columns ---> so we can store different no.of columns on certain rows.


Related Solutions

1) Which of the following statements is true? A) Organizations all have the same set of...
1) Which of the following statements is true? A) Organizations all have the same set of budgets B) Budgets should not be used as part of performance evaluation. C) Budgets are a quantitative expression of an organization’s goals and objectives. D) Organizations are all required to budget 2) A total labor variance is best defined as the difference between total: A) actual cost and the standard cost for the standard hours allowed to produce the output that was made B)...
1.The dimensions or units for the quantity (Pressure * Volume) is the same as the dimensions...
1.The dimensions or units for the quantity (Pressure * Volume) is the same as the dimensions or units of a.force b.energy c.energy/temperature d.force/temperature 2.According to the ideal gas law, PV = constant for a given temperature and amount of gas. As a result, an increase in volume corresponds to a decrease in pressure. According to the kinetic theory, this happens because the molecules a.Collide with each other more frequently b.Move slower on the average. c.Strike the container wall less often....
A. Arrays An array is basically of collection of related variables of the same type. For...
A. Arrays An array is basically of collection of related variables of the same type. For example, a collection of grades of students, a collection of salary of employees of a company, etc. When working with student grades, for example, we can then perform statistical computations on that set of data to obtain more meaningful information. In this part of the lab, you will write a complete C++ program named Lab6A.cpp that allows the user to enter the grades of...
1. Which of the following is not true? A) when a series has the same average...
1. Which of the following is not true? A) when a series has the same average growth rate from period to period, then it can be approximated by including trend in a regression. B) dummy variables can be used to address the problem of seasonality in regression models. C) yt = α0 + β0st + β1st−1 + β2st−2 + β3st−3 +ut , it is possible to estimate long-run effect of change in st on yt . D) serial correlation of...
1)True or False: Ambiguity is a type of vagueness True False 2)True or False: When determining...
1)True or False: Ambiguity is a type of vagueness True False 2)True or False: When determining whether a report of an argument should be treated as an argument, it is important to consider the context in which the report is made. True True False 3) True or False: In a V argument with two premises, if one of the premises is false, then the argument is definitely weak True False 4) True or False: A report of an argument can...
Which of the following is a type 1 error? a. When H0is true and H0 is...
Which of the following is a type 1 error? a. When H0is true and H0 is accepted b. When Hais true and H0 is accepted c. When H0is true and Ha is accepted d. When Hais true and Ha is accepted
1. These three terms all refer to the same part of a database: True or False...
1. These three terms all refer to the same part of a database: True or False Instance Row Field 2. When compared to File Processing systems, select each of the following that are advantages of a database system. Note: there may be more than one right answer. Group of answer choices; A. Shorter development times. B. If the data structure changes, a program may not need to be changed. C. The data does not need to be duplicated. D. There...
c++ language Create a file program that reads an int type Array size 10; the array...
c++ language Create a file program that reads an int type Array size 10; the array has already 10 numbers, but your job is to resize the array, copy old elements of array to the new one and make it user input and add an additional 5 slots in the array, and lastly do binary search based on user input. close the file.
1. Given an array of integers a dimension n. If the array contains the same number...
1. Given an array of integers a dimension n. If the array contains the same number of even and odd elements get (a1 + an) (a2 + an-1) ... 2. Given an array of integers dimension n. All array elements with even numbers preceding the first element to the maximum, multiplied by the maximum. 3. Given an array of dimension n. Insert after each zero element of the element in the middle (or the amount of secondary elements for even...
a. In your own words, assess the organizational dimensions that must be considered when selecting organizational...
a. In your own words, assess the organizational dimensions that must be considered when selecting organizational structures. b. Differentiate between domestic and international marketing. In your own words. give an example as to why they should differ.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT