
C Programming Output Quiz

Quiz
•
Computers
•
University
•
Hard
Karen Tan
FREE Resource
15 questions
Show all answers
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
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
BASIC C PROGRAMMING QUIZ

Quiz
•
University
20 questions
ISTE TECHNICAL

Quiz
•
University
10 questions
PROGRAMACION

Quiz
•
9th Grade - University
12 questions
UNIT 3

Quiz
•
University
13 questions
ÔN TẬP C - mảng 1 chiều

Quiz
•
University
15 questions
DATA STRUCTURES QUIZ

Quiz
•
University
10 questions
Expression in C Programming

Quiz
•
University
12 questions
Operators in C

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