
ICE1111 Revision

Quiz
•
Other
•
University
•
Hard
Eugene Castro
Used 1+ times
FREE Resource
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
A function called buildRandom has to generate a list of 10,000 random floating point values and return these values in an array which is created inside the method itself. Which is the correct method header?
float buildRandom()
double* buildRandom()
double buildRandom(double[] list)
float[10000] buildRandom()
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Assume that numbers is an array of length 100 which has just been filled with 100 non-zero integer values.
Assume that pos holds an integer value in the interval [0,98].
Which statement regarding the code fragment below is true?
int size = 100;
for(int i = pos; i < size-1; i++)
numbers[i] = numbers[i+1];
size--;
The maximum number of assignments performed by the loop will be ninety eight.
The loop will move each array element numbers[i] to numbers[i+1]
The fragment will reduce the number of integers the array numbers can hold
The maximum number of assignments performed by the loop will be ninety nine.
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Assume that the 5 x 5 two-dimensional array called table is used to hold integer values. Which statement below is true?
for(int i = 0; i<5; i++)
for(int j=0; j<5; j++)
table[j][i] = table[i][j];
There is no change to the contents of the 2D array.
Every value in the table is guaranteed to change.
Some values in the table are guaranteed not to change.
The nested loop contains a syntax error.
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What does the nested loop below do?
Assume that the 10 x 10 two-dimensional array called table is used to hold integer values.
int sum = 0;
for(int i = 0; i<4; i++)
for(int j=1; j<=5; j++)
sum += table[i][j];
Sums twenty five values in the array and stores result in sum
Sums twenty values in the array and stores result in sum
Sums twelve values in the array and stores result in sum
Produces separate sums for each of the five constituent arrays of table.
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What elements does the array data contain after the for loop below has executed?
int data[5];
for (int i = 0; i < 5; i++)
data[i] = 2 * i;
0, 2, 4, 6, 0
0, 2, 4, 6, 8
0, 2, 4, 6, 8, 10
2, 4, 6, 8, 10
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the effect of the code fragement below? You may assume that the array list has been properly declared and is completely filled with a set of non-zero integer values.
int list[10];
for(int i = 0; i < 10; i++)
list[i] = list[i+1];
The loop will sort the elements in the array into ascending order.
All elements in list are moved "up one" towards the end of the array (i.e list[list.length-1]).
All elements in list are incremented by one.
Execution of the loop will cause a run-time error.
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the effect of the code fragement below? You may assume that the array values has been properly declared and its size equals 10.
for(int i = 0; i <= 10 ; i++)
printf("%d ", values[i]);
A syntax error will be reported at compile time
Ten integer values will be displayed on the console screen
Ten integer values will be displayed on the consle screen followed by a run-time exception message
No integer values are displayed but a run-time exception message is displayed on the console screen
Create a free account and access millions of resources
Similar Resources on Wayground
27 questions
IAR-ETAPA 1 DRA. GMS

Quiz
•
University
25 questions
HPC 3 Quiz

Quiz
•
University
25 questions
Inter School Quiz (English Medium) Paper 03

Quiz
•
University
25 questions
Introduction to Python and Data Analytics Basics

Quiz
•
University
25 questions
Histologija-nervno tkivo i nervni sistem

Quiz
•
University
25 questions
котлин 50-75 палау

Quiz
•
University
30 questions
Conditional Logic

Quiz
•
9th Grade - University
30 questions
Examen de Programación

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 Other
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