
Exploring 1D Array Loops

Quiz
•
Computers
•
University
•
Hard
Bhawna Suri
Used 7+ times
FREE Resource
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is a 1D array?
A 1D array is a linear collection of elements accessed by a single index.
A 1D array requires multiple indices to access elements.
A 1D array can only store integers.
A 1D array is a two-dimensional structure.
2.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Write a loop to print all elements of a 1D array of length N in C
int i = 1;
while( i <N) { printf("%d\n",array[i]); }
int i = 0;
while(i < N) { printf("%d",array[i++]); }
for(int i = 0; i < N; i++ ) { printf("%d\n",array[i]); }
for(int i = 0; i <= N; i++ ) { printf("%d\n",array[i]); }
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How can you find the length of a 1D array in C?
length = sizeof(array) / sizeof(array[0])
length = count(array)
length = array.length()
length = sizeof(array)
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will be the output of the following code snippet: int arr[] = {1, 2, 3}; for(int i=0; i<3; i++) { printf("%d ", arr[i]); }?
1 2 3
3 2 1
1 2
2 3 4
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
void checkEvenOrNot(int num)
{
if (num % 2 == 0)
goto even;
else
goto odd;
even:
printf("%d is even", num); return;
odd:
printf("%d is odd", num); }
int main()
{
int num = -2;
checkEvenOrNot(num);
return 0;
}
Output
error
-2 is even
-2 is odd
none of the above
Similar Resources on Wayground
7 questions
Java Programming Game

Quiz
•
University
10 questions
unidad4

Quiz
•
University
10 questions
T_4.2 Identifier, Data Types, Operators & Expressions

Quiz
•
12th Grade - University
10 questions
C++ vs Python: A Quiz Introduction

Quiz
•
11th Grade - University
10 questions
Basic C Knowledge Exercise

Quiz
•
University
10 questions
Java Basics

Quiz
•
University
10 questions
Expression in C Programming

Quiz
•
University
10 questions
PROGRAMACION

Quiz
•
9th Grade - University
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
10 questions
Afterschool Activities & Sports

Quiz
•
6th - 8th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
15 questions
Cool Tool:Chromebook

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

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
20 questions
Bullying

Quiz
•
7th Grade
18 questions
7SS - 30a - Budgeting

Quiz
•
6th - 8th Grade
Discover more resources for Computers
36 questions
USCB Policies and Procedures

Quiz
•
University
4 questions
Benefits of Saving

Quiz
•
5th Grade - University
20 questions
Disney Trivia

Quiz
•
University
2 questions
Pronouncing Names Correctly

Quiz
•
University
15 questions
Parts of Speech

Quiz
•
1st Grade - University
1 questions
Savings Questionnaire

Quiz
•
6th Grade - Professio...
26 questions
Parent Functions

Quiz
•
9th Grade - University
18 questions
Parent Functions

Quiz
•
9th Grade - University