
C quiz
Authored by Giri A
Computers
University
Used 5+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
int main() {
int arr[] = {10, 20, 30, 40, 50};
int *ptr = arr;
ptr = ptr + 2;
printf("%d ", *(ptr + 1));
return 0;
}
30
40
50
20
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
#include <string.h>
int main() {
char str[] = "Hello, world!";
printf("%d", strlen(str));
return 0;
}
13
14
12
Undefined behaviour
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
#include <stdlib.h>
int main() {
int *arr = (int *)calloc(3, sizeof(int));
arr[1] = 10;
arr[2] = 20;
free(arr);
printf("%d", arr[2]);
return 0;
}
0
10
20
Undefined behavior
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
#include <stdlib.h>
int main() {
int *arr = (int*)malloc(10 * sizeof(int));
free(arr);
arr[0] = 5;
printf("%d", arr[0]);
return 0;
}
It will print 5.
It will print 0.
It will give a runtime error due to accessing freed memory.
It will give a compilation error.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
int main() {
int x = 5; // Binary: 0101
x = x << 1;
printf("%d", x);
return 0;
}
5
10
20
2
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
struct Person {
char name[30];
int age;
}
int main() {
struct Person persons[2] = {{"John", 25}, {"Jane", 30}};
printf("%d", persons[1].age);
return 0;
}
persons[1].name
persons[0].age
persons[1].age
persons[0].name
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
int main() {
for (int i = 0; i >= 0; i++) {
printf("%d ", i);
}
return 0;
}
The loop will terminate after one iteration.
The loop will run forever.
The loop will run 0 iterations.
It will cause a segmentation fault.
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
14 questions
U3.4. CallableStatements (JDBC)
Quiz
•
University
10 questions
C Programming Quiz-5
Quiz
•
University
10 questions
Session 2
Quiz
•
University
10 questions
T_4.2 Identifier, Data Types, Operators & Expressions
Quiz
•
12th Grade - University
10 questions
IoT Lecture 8 - Data and Analytics for IoT
Quiz
•
University
10 questions
QCM Algorithmes
Quiz
•
University
15 questions
EDA PARTE 2
Quiz
•
University
10 questions
Data Analytics using Python - Quiz 1
Quiz
•
University
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
5 questions
What is Presidents' Day?
Interactive video
•
10th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
20 questions
Mardi Gras History
Quiz
•
6th Grade - University
10 questions
The Roaring 20's Crash Course US History
Interactive video
•
11th Grade - University
17 questions
Review9_TEACHER
Quiz
•
University