Data Representation, Types & Variables

  1. At the most basic level, what values are stored in memory, transmitted on the bus and manipulated in the CPU?
  2. Count from 1 to 10 in binary.
  3. How many distinct values can be stored using n bytes?
  4. Convert the following numbers to base 2: 3010, 20310, 74810, 1023
  5. What is a bit?
  6. What is a byte?
  7. What is ASCII?
  8. What is Unicode?
  9. How is the character ‘A’ stored in computer memory?
  1. What are the two modes in vi and how do you change from one to another?
  2. How do you save a file in vi?
  3. What command do you enter on the command line to submit the problem hello to Kattis assuming you are using Java, your main() function is in the class Hello and your only source code file is Hello.java.
  1. What are the two ways to write comments in Java?
  2. What is a variable?
  3. How is a variable declared?
  4. What are the 8 primitive types?
  5. Which primitive type(s) store whole numbers?
  6. Which primitive type(s) store characters?
  7. Which primitive type(s) store decimal values?
  8. Which primitive type(s) store Boolean values?
  9. What are the differences between the types that store whole numbers?
  10. What are the differences between the types that store decimal numbers?
  11. What is an identifier?
  12. What are the rules for naming identifiers?
  13. What is a literal?
  14. How do you initialize a variable?
  15. Declare a variable named height that stores a whole number and initialize it to hold the value 70.
  16. Declare a variable named initial that stores a character and initialize it to hold the character X.
  17. Declare a variable named response that stores a Boolean value and initialize it to hold the value false.
  18. Declare a variable named area that stores a decimal number and initialize it to hold the value 3.705.
  19. Declare a variable named title that stores a string of characters and initialize it to hold the value Papillion.
  20. What are the names of the two streams that are automatically available to Java programmers? Describe what these streams are used for.
  21. Write a statement that prints “I am 70 inches tall” using the variable height defined above.
  22. Write a statement that prints “My middle initial is X” using the variable initial defined above.
  23. Write a statement that prints “The respondent answered false” using the variable response defined above.
  24. Write a statement that prints “The area of the circle is 3.7 sq. ft.” using the variable area defined above.
  25. Write a statement that prints “Have you read the book Papillion?” using the variable title defined above?
  26. Write a complete block of code that reads an integer from the keyboard and stores the value in a variable named age.

© 2017, Eric. All rights reserved.