
MidExam- Data Structures and Algorithms
Authored by Aileen Torre
Computers
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
39 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly initializes an integer array in C#?
int[] numbers = {1, 2, 3};
int[] numbers = new Array(3);
int[] numbers = new int[3]{1, 2, 3, 4};
int numbers = {1, 2, 3};
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you access the first element of an array named data in C#?
data[0]
data(1)
data.First()
data.[1]
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following code, what is the output?
int[] arr = {10, 20, 30};
Console.WriteLine(arr.Length);
2
3
30
Error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does a multidimensional array differ from a jagged array in C#?
Multidimensional arrays are rectangular, jagged arrays are triangular
Jagged arrays use [,] notation while multidimensional arrays use [][]
Jagged arrays are arrays of arrays, multidimensional arrays are a grid-like structure
There is no difference
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the following code?
int[,] matrix = new int[2, 2] {{1, 2}, {3, 4}};
Console.WriteLine(matrix[1, 1]);
1
2
3
4
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to iterate over all elements in a C# array?
foreach (var item in array)
for (item in array)
while (array hasNext)
repeat array
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for declaring a multidimensional array in C#?
int array[2, 3];
int array[,] = new int[2, 3];
int array[2][3];
int[,] array = new int[2, 3];
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
38 questions
Trắc Nghiệm Tin 9 GK2
Quiz
•
9th Grade - University
40 questions
SPG-Unit 2 complete
Quiz
•
University
40 questions
UAS Kemsis 2023
Quiz
•
University
35 questions
Database
Quiz
•
KG - University
34 questions
MOS Word 2016 - Quiz 2
Quiz
•
University
40 questions
Introduction to Web Systems Exam
Quiz
•
University
35 questions
IT 115 Module Quiz
Quiz
•
University
40 questions
Class Test 1 - CSE 443 (Mobile Telecommunication)
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade