Mastering C Functions and Conditions

Mastering C Functions and Conditions

12th Grade

35 Qs

quiz-placeholder

Similar activities

Assessment Tengah Semester Ganjil

Assessment Tengah Semester Ganjil

8th Grade - University

35 Qs

XII, Informatika Masa Sekarang dan Masa depan

XII, Informatika Masa Sekarang dan Masa depan

12th Grade

30 Qs

Tin học

Tin học

12th Grade - University

35 Qs

Cyber Security Quiz

Cyber Security Quiz

12th Grade

35 Qs

SOAL PERSIAPAN PSTS GANJIL 2024/2025 - INFORMATIKA 12 FASE F

SOAL PERSIAPAN PSTS GANJIL 2024/2025 - INFORMATIKA 12 FASE F

12th Grade

30 Qs

UFCD 5098 & 769 - Arquitetura de hardware

UFCD 5098 & 769 - Arquitetura de hardware

12th Grade

30 Qs

SAS INFORMATIKA KELAS VII TP 2025/2026

SAS INFORMATIKA KELAS VII TP 2025/2026

7th Grade - University

30 Qs

Ice Breaking

Ice Breaking

4th Grade - University

36 Qs

Mastering C Functions and Conditions

Mastering C Functions and Conditions

Assessment

Quiz

Information Technology (IT)

12th Grade

Practice Problem

Medium

Created by

Karen Tan

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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.

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?