2.14. Activecode Exercises

Answer the following Activecode questions to assess what you have learned in this chapter.

Fix the code below so that it runs without errors. Hint: you might need to change the names of some variables.

Below is one way to fix the program. true and false are keywords, so they cannot be used as variable names.

Loading a dynamic question ...
Selecting from: VARS_a2, VARS_a2_p

Fix the code below so that it prints “Cady scored 90% on the exam.”

Below is one way to fix the program. We want to use doubles so that our result isn’t rounded down to 0 through integer division.

Loading a dynamic question ...
Selecting from: VARS_a4, VARS_a4_p

Fix the code below so that assigns a its correct value of 'a'. Hint: use character operations!

Below is one way to complete the program. There are many creative ways that you could use the order of operations to come up with a complex expression that will bring you to 'a', here is one way.

Loading a dynamic question ...
Selecting from: VARS_a6, VARS_a6_p

Write code that prints “Eat”, “More”, and “Chicken” on 3 consecutive lines. Be sure to inclue any necessary headers.

Below is one way to implement the solution.

Loading a dynamic question ...
Selecting from: VARS_a8, VARS_a8_p

You have about three hours and fifteen minutes of homework to do today. Rather than starting it right away, you choose to procrastinate by calculating how many seconds you’ll be spending on your work. Convert the time to seconds and store the result in seconds. Be sure to inclue any necessary headers.

Below is one way to implement the solution.

Loading a dynamic question ...
Selecting from: VARS_a10, VARS_a10_p

You have attempted of activities on this page