Search Header Logo

PIF Session 5B Assessment

Authored by Chun Ng

Engineering

9th - 12th Grade

Used 1+ times

PIF Session 5B Assessment
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the purpose of the switch...case statement in Arduino?

To repeat a block of code multiple times
To define a function
To select one of many code blocks to be executed based on a variable's value
To pause program execution for a specific time
To declare an array

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What does the following code snippet do? <br> while (count < 10) {<br> // Code to be executed<br> count++;<br> }

Executes the code block 9 times
Executes the code block 10 times
Executes the code block 11 times
Executes the code block indefinitely
Causes a compile-time error

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the purpose of the break; statement in a switch...case structure?

To skip to the next case
To exit the entire program
To exit the switch...case structure
To pause program execution
To define a new variable

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the purpose of the continue; statement in a loop?

To exit the loop completely
To skip the rest of the current iteration and proceed to the next
To pause loop execution
To define a new variable
To restart the loop from the beginning

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the correct way to declare an array of 5 integers named myArray in Arduino?

int[5] myArray;
myArray int[5];
int myArray{5};
int myArray[5];
array myArray[5];

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What does the following code snippet do? <br> for (int i = 0; i < 5; i++) {<br> myArray[i] = i * 2;<br> }

Fills the array with random numbers
Fills the array with the numbers 0 to 4
Fills the array with the numbers 0, 2, 4, 6, 8
Fills the array with the numbers 2, 4, 6, 8, 10
Causes a compile-time error

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the index of the last element in an array of size 10?

10
9
1
It depends on the data type of the array

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?