HW1 - run-time error c forgetting a semicolon at the end of...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1.5. If a language uses 240 unique letters and symbols, how many bits would be needed to store each character of a document? Why? You would need 2^8 bits because to represent 240 unique letters and symbols you need at least 240 bits and the smallest 2^N integer is 2^8 = 256. 1.11. What is the total number of communication lines needed for a fully connected point-to- point network of eight computers? Nine computers? Ten computers? What is a general formula for determining this result? Eight Computers – 28 Nine Computers – 36 Ten Computers – 45 Formula: n(n - 1) / 2 where n is the number of computers 1.16. What of the following are not valid Java identifiers? Why? C because an identifier may not start with a number and g because an identifier may not 1.20 Categorize each of the following situations as a compile-time error, run-time error, or logical error. a. multiplying two numbers when you meant to add them logical error b. dividing by zero
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: run-time error c. forgetting a semicolon at the end of a programming statement compile-time error d. spelling a word wrong in the output logical error e. production inaccurate results logical error f. typing a { when you should have typed ( compile-time error PP 1.4. Write an application that prints the phrase Knowledge is Power: a. On one line b. On three lines, one word per line, with the words centered relative to each other c. Inside a box made up of the characters = and | public class HW1 { public static void main (String args) { System.out.println("Knowledge is power"); System.out.println(""); System.out.println(""); System.out.println("Knowledge"); System.out.println(" is"); System.out.println(" power"); System.out.println(""); System.out.println(""); System.out.println("===================="); System.out.println("|Knowledge is power|"); System.out.println("===================="); } }...
View Full Document

This note was uploaded on 03/22/2012 for the course COMPSCI 125 taught by Professor Cole during the Spring '12 term at Boise State.

Page1 / 2

HW1 - run-time error c forgetting a semicolon at the end of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online