Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 1.1 KB

File metadata and controls

26 lines (20 loc) · 1.1 KB

1. How are integers stored on a computer?
Integers are stored using the binary system.

2. We know that (in base 10) the largest 1 digit number is 9 and the largest 2 digit number is 99. Given that in binary the largest 2 digit number is 11 (3), the largest 3 digit number is 111 (7) and the largest 4 digit number is 1111 (15) what's the largest 8 digit number?
The largest 8 digit number is 11111111 (255).

3. Although overpowered for the task you can use Go as a calculator. Write a program that computes 321325 x 424521 and prints it to the terminal. (Use the * operator for multiplication)

package main

import "fmt"

func main() {
    fmt.Println(321325 * 424521)
}

4. What is a string? How do you find its length?
A string is a sequence of characters with a definite length.
To find the length of a string we use the len function.

5. What's the value of the expression (true && false) || (false && true) || !(false && false)?
(true && false) || (false && true) || !(false && false) => false || false || !false => false || true => true