
WTN-12-QUIZ-3

Quiz
•
Computers
•
University
•
Hard
arunasri pabbisetti
Used 5+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How many columns does a have if it is created as follows
int[][] a = { {2, 4, 6, 8}, {1, 2, 3, 4}};?
2
4
8
16
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the index variable for the element at the first row and first column in array
a?
.
a[0][0]
a[1][1]
a[0][1]
a[1][0]
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following statements assigns the letter S to the third row and first column of a two-dimensional array named strGrid (assuming row-major order).
strGrid[0][2] = "S";
strGrid[1][3] = "S";
strGrid[3][1] = "S";
strGrid[2][0] = "S";
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How would you get the value 6 out of the following array
int[][] a = { {2, 4, 6, 8}, {1, 2, 3, 4}};?
a[0][3]
a[1][3]
a[0][2]
a[2][0]
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Given the following code segment, what is the value of sum after this code executes?
int[][] matrix = { {1,1,2,2},{1,2,2,4},{1,2,3,4},{1,4,1,2}};
int sum = 0; int col = matrix[0].length - 2; for (int row = 0; row < 4; row++) { sum = sum + matrix[row][col]; }
4
8
9
12
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What are the contents of mat after the following code segment has been executed?
int [][] mat = new int [4][3]; for (int row = 0; row < mat.length; row++) { for (int col = 0; col < mat[0].length; col++) { if (row < col) mat[row][col] = 1; else if (row == col) mat[row][col] = 2; else mat[row][col] = 3; } }
{ {2 3 3}, {1 2 3}, {1 1 2}, {1 1 1}}
{ {2 1 1}, {3 2 1}, {3 3 2}, {3 3 3}}
{ {2 1 1 1}, {3 2 1 1}, {3 3 2 1}}
{ {2 3 3 3}, {1 2 3 3}, {1 1 2 3}}
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Given the following code segment, what is the value of sum after this code executes?
int[][] m = { {1,1,1,1},{1,2,3,4},{2,2,2,2},{2,4,6,8}}; int sum = 0; for (int k = 0; k < m.length; k++) { sum = sum + m[m.length-1-k][1]; }
A. 4 B. 6 C. 9 D. 10
4
6
9
10
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Basics Of C Programming

Quiz
•
University
10 questions
SQL basic

Quiz
•
University
10 questions
NumpyPandas

Quiz
•
University
15 questions
Coding club Summit Online Quiz

Quiz
•
University
10 questions
Compose Camp - Session 2 Quiz

Quiz
•
University
9 questions
c language quiz

Quiz
•
University
10 questions
Weekly Contest #3 - TechXNinjas

Quiz
•
University
10 questions
C - Pointers

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University