
C Programming Output Quiz
Authored by Karen Tan
Computers
University
15 Questions

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
1.
MULTIPLE CHOICE QUESTION
3 mins • 20 pts
What will be the output of the following code snippet below? #include int main() { int arr[3] = {10, 20, 30}; printf("%d", arr[1]); return 0; }
10
20
30
Garbage value
2.
MULTIPLE CHOICE QUESTION
3 mins • 20 pts
What will be the output of the following code snippet below? #include int main() { int arr[] = {1, 2, 3, 4, 5}; for (int i = 0; i int main() { int arr[5] = {2, 4, 6, 8, 10}; arr[2] = 12; printf("%d", arr[2]); return 0; }
6
12
10
Compilation Error
3.
MULTIPLE CHOICE QUESTION
3 mins • 20 pts
What will be the output of the following code snippet below? #include <stdio.h>
int main() {
int arr[] = {1, 2, 3, 4, 5};
for (int i = 0; i < 5; i++)
printf("%d ", arr[i]);
return 0;
}
A) 1 2 3 4 5
B) 5 4 3 2 1
C) Compilation error
D) 0 0 0 0 0
4.
MULTIPLE CHOICE QUESTION
3 mins • 20 pts
What will be the output of the following code snippet below? #include int main() { int arr[] = {5, 10, 15, 20}; int *ptr = arr; printf("%d", *(ptr + 2)); return 0; }
5
10
15
20
5.
MULTIPLE CHOICE QUESTION
3 mins • 20 pts
What will be the output of the following code snippet below? #include <stdio.h>
int main() {
int arr[] = {4, 8, 12, 16};
printf("%lu", sizeof(arr));
return 0;
}
4
16
8
12
6.
MULTIPLE CHOICE QUESTION
3 mins • 20 pts
What will be the output of the following code snippet below? #include <stdio.h>
int main() {
int arr[3] = {1, 3, 5};
int *ptr = arr;
for (int i = 0; i < 3; i++)
printf("%d ", *(ptr + i));
return 0;
}
A) 1 3 5
B) 3 5 1
C) 5 3 1
D) Compilation error
7.
MULTIPLE CHOICE QUESTION
3 mins • 20 pts
What will be the output of the following code snippet below? #include #include int main() { int *arr = (int*) malloc(3 * sizeof(int)); arr[0] = 10; arr[1] = 20; arr[2] = 30; printf("%d", arr[1]); free(arr); return 0; }
10
20
30
Undefined Behavior
Access all questions and much more by creating a free account
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
Already have an account?
Similar Resources on Wayground
10 questions
ICT 1202-B-2021-Q1
Quiz
•
University
18 questions
Juego sobre pseudocódigo en PseInt
Quiz
•
University
10 questions
Quiz 1
Quiz
•
University
15 questions
Sains Komputer Tingkatan 5 - 1.3.3 Membina Jadual Kebenaran
Quiz
•
1st Grade - Professio...
10 questions
java quiz based on interface
Quiz
•
University
12 questions
Python Quiz 1.4
Quiz
•
University
10 questions
Logika Fuzzy
Quiz
•
University
20 questions
Quiz Inf X.B
Quiz
•
10th Grade - University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
14 questions
Christmas Trivia
Quiz
•
3rd Grade - University
20 questions
Christmas Trivia
Quiz
•
University
8 questions
5th, Unit 4, Lesson 8
Lesson
•
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
•
University