Q3

Lesson 3 Quiz: Calculations with Variables

Test your understanding of using variables for math, conversions, and clear Serial output

32-Week Course � Semester 1

Quiz Instructions

  • � This quiz covers material from Lesson 3: Calculations with Variables
  • � Answer all questions to the best of your ability
  • � Your responses will be emailed to your instructor for review
  • � Take your time and think carefully about each answer
  • � You can review the lesson material if needed before submitting

Student Information

Question 1: Choosing a Variable Type

Which variable type is the best choice for a temperature value like 23.5?

Question 2: Arithmetic

If int apples = 3; and int oranges = 5;, what does apples + oranges equal?

Question 3: Reading a Formula

What does this formula do? float fahrenheit = (celsius * 9.0 / 5.0) + 32.0;

Question 4: Constants

What is the purpose of a line like const int totalPoints = 10;?

Question 5: Percentages

If a student scores 8 out of 10, which expression correctly calculates the percentage?

Question 6: Serial Output

Which code best prints a label and a value clearly, like Score: 8, to the Serial Monitor?

Question 7: Code Analysis

Explain what happens in this code snippet:

int score = 8;
int total = 10;
float percentage = (score / 10.0) * 100.0;
Serial.println(percentage);

Question 8: Simple Calculator Program

Describe the simple calculator-style program you created. What values did you use, what calculation did your code perform, and what did it print to the Serial Monitor?