0
0
Embedded Cprogramming~10 mins

Floating point cost on embedded systems in Embedded C - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a floating point variable.

Embedded C
float [1] = 3.14f;
Drag options to blanks, or click blank then click option'
Acount
BintVar
Cpi
Dindex
Attempts:
3 left
💡 Hint
Common Mistakes
Using integer-like variable names for floats.
2fill in blank
medium

Complete the code to perform floating point addition.

Embedded C
float result = [1] + 2.5f;
Drag options to blanks, or click blank then click option'
A3.0f
Bindex
Ccount
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using integers without 'f' suffix for float operations.
3fill in blank
hard

Fix the error in the floating point division.

Embedded C
float division = 5 / [1];
Drag options to blanks, or click blank then click option'
A2
Bcount
C0
D2.0f
Attempts:
3 left
💡 Hint
Common Mistakes
Using integer divisor causing integer division.
4fill in blank
hard

Fill both blanks to create a float array and initialize it.

Embedded C
float [1][3] = {1.0f, [2], 3.0f};
Drag options to blanks, or click blank then click option'
Avalues
B2.0f
Ccount
Dindex
Attempts:
3 left
💡 Hint
Common Mistakes
Using integer literals instead of float literals in initialization.
5fill in blank
hard

Fill all three blanks to compute the average of three floats.

Embedded C
float average = ([1] + [2] + [3]) / 3.0f;
Drag options to blanks, or click blank then click option'
Aval1
Bval2
Cval3
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using integer variables or missing one of the variables in the sum.