How many times will the following for loop iterate?
for (int i = 0; i < 5; i++) {
// code here
}
Computer Programming-2
Quiz
•
Computers
•
University
•
Hard
Zeel Mehta
Used 17+ times
FREE Resource
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many times will the following for loop iterate?
for (int i = 0; i < 5; i++) {
// code here
}
5
4
3
2
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax of a simple for loop in C?
for (initialize; condition; increment) { }
for (initialize: condition: increment); { }
for (initialize; condition: decrement); { }
for (initialize: condition: decrement) { }
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to declare a 1-D array named "numbers" of 5 integers in C?
int numbers[ ] = {5};
numbers [5];
numbers = {5};
int numbers [5];
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet?
char str[5] = "Hello";
printf("%c", str[4]);
\0
e
l
o
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is not the correct way to initialize an array named "grades" with the values 90, 85, 95, and 80 in C?
int grade[10] ={90, 85, 95, 80};
int grades[4] = {90, 85, 95, 80};
int grades[ ] = {90, 85, 95, 80};
int grades[4] = {90, 85, 95, 80}
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following functions can be used to find the length of a string in C?
strlenn()
strnlen()
strlen()
strlan()
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet?
char str1[10] = "Hello";
char str2[20] = {'H', 'e', 'l', 'l', 'o', ' ','\0'};
if (strcmp(str1, str2) == 0) {
printf("Equal");
} else {
printf("Not equal");
}
Runtime Error
Equal
Compile time Error
Not Equal
30 questions
Coding Competation(Round 1)
Quiz
•
University
27 questions
IEEE Coding Cybersecurity
Quiz
•
University
25 questions
Latihan soal Algoritma dan Pemrograman
Quiz
•
University
25 questions
Compro. Final 1/64 part1
Quiz
•
University
25 questions
GNIDOC ROUND 1
Quiz
•
University
25 questions
C Programing
Quiz
•
University
25 questions
C- Geniusia
Quiz
•
University
25 questions
C/C++ Programming Quiz
Quiz
•
University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade