Mixed-Up Code Exercises

Answer the following Mixed-Up Code questions to assess what you have learned in this chapter.

Construct a block of code that prints: “Lions &” one the first line, “Tigers & Bears!” on the second line, and “Oh my!” on the FOURTH line.

Construct a block of code that swaps the value of integers x and y, which have values 3 and 6, respectively.

Dan Humphrey is a 3.98 student at Constance High School. His crush’s first initial is S. Construct a program that assigns the variables name, GPA, and crush, in that order.

You decide to make homemade Mac ‘n’ Cheese for you and your roomates. Whoever wrote the recipe wanted to make things hard for you by stating that it calls for 1% of a gallon of milk. Construct a block of code that converts this to tablespoons.

Construct a block of code that takes the volume of the rectangular prism defined by length, width, and height and prints the result to the terminal.

Construct a block of code that changes the value of the variable a from the character ‘a’ to the character ‘z’.

Construct a block of code that outputs the volume of a cylinder with a radius of 3 and a height of 4. There are many ways to do this using the choices below, but only the correct answer that uses the LEAST lines of code will be accepted.

Construct a block of code that prints “My favorite class is MATH” on the same line.

It’s Black Friday and the Nintendo Switch you’be been saving up for is marked down to 60% of its original price! Construct a block of code that calculates how much money you’d be saving if the system originally costed $359.99?

Your family just bought a dog and everyone has been fighting over what to name it. It went from Champ to Copper to Higgins, and after a few days of being Higgins, everyone agreed on Buddy. Construct a block of code that illustrates this concept.

You have attempted of activities on this page