
Understanding Loops and Functions
Quiz
•
Information Technology (IT)
•
12th Grade
•
Medium
Karen Tan
Used 1+ times
FREE Resource
Enhance your content in a minute
40 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
What is the primary difference between a for loop and a while loop?
A for loop can only iterate over arrays, while a while loop can iterate over any data type.
A while loop is always faster than a for loop regardless of the situation.
A for loop requires a condition to terminate, while a while loop does not.
The primary difference is that a for loop is used for a known number of iterations, while a while loop is used for an unknown number of iterations based on a condition.
2.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
How do you declare a pointer in C?
int ptr;
pointer int *ptr;
int &ptr;
int *ptr;
3.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
What is the output of the following code snippet: int a = 5; int *p = &a; printf('%d', *p);?
4
5
6
10
4.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
Explain the purpose of user-defined functions in programming.
User-defined functions in programming serve to create reusable code blocks that enhance organization, readability, and maintainability.
User-defined functions are only used for debugging purposes.
User-defined functions are mandatory for all programming languages.
User-defined functions can only be used once in a program.
5.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
What will happen if you try to dereference a null pointer?
The program will continue running without any issues.
A runtime error occurs, often leading to a crash.
A warning message will be displayed, but execution will proceed.
The pointer will automatically be assigned a valid memory address.
6.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
Write a simple for loop that prints numbers from 1 to 10.
for (let i = 1; i < 10; i++) { console.log(i); }
for (let i = 1; i <= 5; i++) { console.log(i); }
for (let i = 0; i < 10; i++) { console.log(i); }
for (let i = 1; i <= 10; i++) { console.log(i); }
7.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
What is the syntax for a do-while loop?
while (condition) { /* code block */ } do;
do { /* code block */ } while (condition);
do { /* code block */ } until (condition);
do (condition) { /* code block */ } while;
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
40 questions
UAS SMP Informatika Kelas IX 2024-2025
Quiz
•
9th Grade - University
40 questions
CSS 3rd Quarter Examination
Quiz
•
11th Grade - University
35 questions
PKL CICIMANJA
Quiz
•
12th Grade - University
40 questions
Web Dev Quiz
Quiz
•
9th - 12th Grade
40 questions
Quiz Informatika Kelas X SMA
Quiz
•
10th Grade - University
42 questions
Asesmen Sumatif
Quiz
•
12th Grade
35 questions
UH Materi Ms. Word
Quiz
•
7th Grade - University
35 questions
NILAI PRA PAT KELAS 11 B
Quiz
•
11th Grade - University
Popular Resources on Wayground
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Order of Operations
Quiz
•
5th Grade
20 questions
Halloween
Quiz
•
5th Grade
16 questions
Halloween
Quiz
•
3rd Grade
12 questions
It's The Great Pumpkin Charlie Brown
Quiz
•
1st - 5th Grade
20 questions
Possessive Nouns
Quiz
•
5th Grade
10 questions
Halloween Traditions and Origins
Interactive video
•
5th - 10th Grade
Discover more resources for Information Technology (IT)
20 questions
Halloween movies trivia
Quiz
•
7th - 12th Grade
15 questions
Halloween Characters
Quiz
•
7th - 12th Grade
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
11 questions
Halloween Trivia #2
Quiz
•
12th Grade
14 questions
Halloween Fun
Quiz
•
2nd - 12th Grade
8 questions
Veterans Day Quiz
Quiz
•
12th Grade
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade
21 questions
Halloween & Math
Quiz
•
8th - 12th Grade
