CMDP2063 Unix and C Programming
Quiz
•
Information Technology (IT)
•
University
•
Medium
Hanley Fong
Used 2+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct syntax for a block comment in C?
// Being weak is nothing to be ashamed of. Staying weak is.
<!-- Being weak is nothing to be ashamed of. Staying weak is. -->
/* Being weak is nothing to be ashamed of. Staying weak is. */
#Being weak is nothing to be ashamed of. Staying weak is.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if you try to use a // comment in C89?
The code will compile successfully.
It will cause a syntax error.
The comment will be ignored, and the code will run normally.
The // will be treated like a block comment.
Answer explanation
In C89 (also known as ANSI C), the // syntax for single-line comments is not supported. C89 only supports comments that are enclosed in /* ... */ for both single-line and multi-line comments. Using // in C89 will result in a syntax error because the compiler does not recognize it as valid comment syntax. Single-line comments using // were introduced in C99.
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the output of the following C program?
No output
Answer explanation
In this program, the for loop iterates with i starting from 0 and increments until i is less than 5.
Inside the loop:
When i is 3, the if (i == 3) condition is true, and the break statement is executed, which immediately exits the loop.
Therefore, only the values 0, 1, and 2 are printed before the loop is terminated.
So, the output is 0 1 2.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What happens in this program when the square() function is called?
Compile Error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following format specifiers is used to print a floating-point value using printf()?
%f
%d
%c
%s
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following program in the image when using printf()?
I have been learning %c for %d %s.
I have been learning c for %d days.
I have been learning for 42 days.
I have been learning C for 42 days.
Answer explanation
Explanation: The printf() function uses format specifiers to insert the values:
- %c is replaced by 'C'
- %d is replaced by 42
- %s is replaced by "days"
So, the final output is: "I have been learning C for 42 days."
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the benefit of using forward declarations in C?
To reduce the size of the executable file
To allow the use of functions before they are defined in the source code
To enhance the readability of the code
To automatically generate documentation
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
20 questions
PTS Genap Informatika Kelas XI
Quiz
•
11th Grade - University
10 questions
Quiz on Basics of C
Quiz
•
University
13 questions
Nano quiz: Bottleneck of Motivation 2 and Receptivity Threshold
Quiz
•
University
20 questions
DATA STRUCTUIR Quiz1 (AIML)
Quiz
•
University
20 questions
GDG ANDROID BOOTCAMP QUIZ
Quiz
•
University
16 questions
Kuis Uji Pemahaman Python Variabel, Sintaks Dasar, Type Data
Quiz
•
11th Grade - University
12 questions
Recap W02 - W04 Information and Communication Technology
Quiz
•
University
20 questions
Mesin Pencari Artikel
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)
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
12 questions
Halloween
Quiz
•
3rd Grade - University
5 questions
Using Context Clues
Interactive video
•
4th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
14 questions
Eat Healthy,Be Healty
Quiz
•
4th Grade - University
7 questions
History of Halloween: Pagan or Christian?
Interactive video
•
11th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
