
Mastering C Functions and Conditions
Authored by Karen Tan
Information Technology (IT)
12th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
35 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
What is the correct syntax for declaring a function in C?
function_name(parameter_type) return_type { /* function body */ }
function_name { return_type parameter_type parameter_name }
return_type function_name(parameter_type parameter_name) { /* function body */ }
return_type function_name(parameter_name parameter_type) { }
2.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
How do you define a function that takes two integers and returns their sum?
def calculate_sum(a, b): return a / b
def total(a, b): return a * b
def add_numbers(x, y): return x - y
def sum_integers(a, b): return a + b
3.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
What is the purpose of the 'if' statement in C programming?
To create loops in C programming.
To define a function in C programming.
To declare variables in C programming.
To execute code conditionally based on a boolean expression.
4.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
How does the 'else' statement work in conjunction with 'if'?
The 'else' statement runs before the 'if' condition is checked.
The 'else' statement is only used for loops, not conditionals.
The 'else' statement executes when the 'if' condition is false.
The 'else' statement can execute multiple times if the 'if' condition is true.
5.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
What is the syntax for a switch case statement in C?
if(condition) { // statements }
while(condition) { // statements }
switch(expression) { case constant1: // statements break; case constant2: // statements break; default: // statements }
for(initialization; condition; increment) { // statements }
6.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
How do you handle multiple cases in a switch statement?
Use if-else statements for all cases.
Only use a default case for handling multiple values.
Each case must have a separate block of code.
Use case 'value1', case 'value2': to group cases together.
7.
MULTIPLE CHOICE QUESTION
5 mins • 20 pts
What is the default case in a switch statement used for?
To replace all other cases in a switch statement.
To define the main case in a switch statement.
To handle unmatched cases in a switch statement.
To optimize the performance of the switch statement.
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
30 questions
Informatika Sekarang dan Nanti Kelas 12
Quiz
•
12th Grade
30 questions
Empowerment Technologies Long Quiz
Quiz
•
12th Grade - University
32 questions
Sistematizacija gradiva V razred
Quiz
•
5th Grade - University
31 questions
Basic Linux CLI Commands
Quiz
•
11th Grade - University
30 questions
Quiz Microsoft Word
Quiz
•
9th Grade - University
40 questions
Ulangan Harian
Quiz
•
11th Grade - University
40 questions
TIK CLASS 7
Quiz
•
7th Grade - University
33 questions
Thiết bị và giao thức mạng (Lớp 12)
Quiz
•
12th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
29 questions
Alg. 1 Section 5.1 Coordinate Plane
Quiz
•
9th Grade
22 questions
fractions
Quiz
•
3rd Grade
11 questions
FOREST Effective communication
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Information Technology (IT)
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
22 questions
El Imperfecto
Quiz
•
9th - 12th Grade
20 questions
SSS/SAS
Quiz
•
9th - 12th Grade
20 questions
verbos reflexivos en español
Quiz
•
9th - 12th Grade
14 questions
Making Inferences From Samples
Quiz
•
7th - 12th Grade
23 questions
CCG - CH8 Polygon angles and area Review
Quiz
•
9th - 12th Grade
8 questions
Momentum and Collisions
Lesson
•
9th - 12th Grade
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade