
Learn2Code

Quiz
•
Engineering
•
Professional Development
•
Hard
arun h
Used 1+ times
FREE Resource
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program?
#include <stdio.h>
int main() {
int i;
for (i = 0; i < 5; i++);
printf("%d ", i);
return 0;
}
Prints 0 1 2 3 4
Prints 5 only
Infinite loop
Compilation error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of executing the following code?
#include <stdio.h>
int main() {
for (int j = 0; j < 3; j++) {
printf("Hello World\n");
}
return 0;
}
Hello World Hello World Hello World
3 times Hello World
Compilation error
Hello World
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the result of the following code?
#include <stdio.h>
int main() {
int a = 10, b = 0;
printf("%d", a / b);
return 0;
}
0
10
Runtime error (division by zero)
Compilation error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will happen when you run this program?
#include <stdio.h>
int main() {
int arr[5] = {1, 2, 3, 4, 5};
printf("%d", arr[5]);
return 0;
}
Output is 5
Output is 0
Undefined behavior / garbage value
Compilation error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What’s wrong in the following code?
#include <stdio.h>
int main() {
int i = 1;
while (i <= 5) {
printf("%d ", i);
}
return 0;
}
Infinite loop
Compilation error
Prints 1 to 5
Prints 1 repeatedly and exits
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of this code?
#include <stdio.h>
int main() {
int a = 7;
if (a = 10) {
printf("Condition is true\n");
}
return 0;
}
Condition is true
Compilation error
Condition is false
No output
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will this code print?
#include <stdio.h>
int main() {
int a = 5;
printf("%d\n", a++ + ++a);
return 0;
}
11
12
Undefined behavior
Compilation error
Create a free account and access millions of resources
Similar Resources on Wayground
25 questions
Quiz on 8051 Microcontroller

Quiz
•
Professional Development
25 questions
Pre Test in Soil

Quiz
•
Professional Development
30 questions
152 Kahoot 13

Quiz
•
Professional Development
35 questions
Quiz on Hardware and Software Components

Quiz
•
Professional Development
27 questions
Python Test10

Quiz
•
Professional Development
25 questions
QUIZZERIA

Quiz
•
Professional Development
25 questions
PythonQuizOnKeywordsVariablesExpressionsOperators&Statements

Quiz
•
Professional Development
29 questions
152 revision #5

Quiz
•
Professional Development
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
10 questions
Chaffey

Quiz
•
9th - 12th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
22 questions
6-8 Digital Citizenship Review

Quiz
•
6th - 8th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade