Send a link to your students to track their progress
587 Terms
1
New cards
What does IDE stand for?
Integrated Development Environment
2
New cards
What IDE will we use in class this semester?
Eclipse
3
New cards
What does CPU stand for?
Central Processing Unit
4
New cards
Define the term "bit".
A "binary digit" -- either 0 or 1.
5
New cards
Define the term "byte".
A sequence of 8 bits.
6
New cards
What is "hardware"? Name some examples.
Physical components of the computer. (Things you can "touch"). Examples include: CPU, RAM chips, mother board, disk drives, monitor, mouse, keyboard, cables.
7
New cards
What is "software"? Name some examples.
These are the "programs" or "apps" that you can run on a computer. Examples: Internet browsers, games, word processors, spreadsheet programs, the operating system, etc.
8
New cards
Name several different operating systems.
Windows, macOS, Android, ios.
9
New cards
Give some examples of secondary memory devices.
Hard drives, flash memory devices, CD's , DVD's
10
New cards
What is the advantage of primary memory over secondary?
It is typically much faster.
11
New cards
What is the advantage of secondary memory over primary?
It is permanent. (Also usually there is more of it!)
12
New cards
What does I/O stand for? Give some examples of I/O devices.
Input/Output. These are devices that allow you to communicate with the computer: monitor, keyboard, mouse, printer, etc.
13
New cards
How many different combinations of 0's and 1's can be represented using 7 bits?
2^7 = 128
14
New cards
How many bytes are in a kilobyte? Megabyte? Gigabyte?
2^10, 2^20, 2^30 or 1000, 1 million, 1 billion
15
New cards
Name four things that the operating system does for you.
What do you call the language that the CPU uses (0's and 1's represent instructions in this language).
Machine Language
17
New cards
How does "assembly language" relate to your answer to the previous question?
Assembly language is a mnemonic representation of machine language.
18
New cards
When your Java program is compiled, what type of file is created? (Hint: It is NOT machine language.)
Bytecode
19
New cards
What does it mean for someone to say that a Java program is "portable"?
The same bytecode will run successfully on any platform (provided that the Java Virtual Machine (JVM) is available.)
20
New cards
TRUE/FALSE: Inserting unnecessary spaces and/or blank lines could cause your Java program to malfunction.
False, java ignores white space
21
New cards
List the four Java primitive types that can be used to store integer values.
long, int, short, byte
22
New cards
How much memory is required to store long?
8 bytes
23
New cards
How much memory is required to store int?
4 bytes
24
New cards
How much memory is required to store short?
2 bytes
25
New cards
How much memory is required to store byte?
1 byte
26
New cards
What advantage do you gain from using one of the types of integer types that requires MORE memory?
You can store a wider range of values (larger values).
27
New cards
List the two Java primitive types that can be used to store floating point values.
float, double
28
New cards
How much memory is required to store a double?
8 bytes
29
New cards
How much memory is required to store a float?
4 bytes
30
New cards
What advantage do you gain from using double instead of float?
more precision (it will retain more digits) (recall a double uses 8 byte and a float uses 4 bytes)
31
New cards
List the two Java primitive types that are used to store values that are not numbers.
char and boolean
32
New cards
Write a statement that declares a variable named counter of type int, and stores the value 182 in the variable.
int counter = 182;
33
New cards
Write a statement that simultaneously declares three variables of type boolean, named x, y, and z.
boolean x, y, z;
34
New cards
What values can a boolean variable achieve?
true or false
35
New cards
Write a java class called "Fred". Put in a main method. Have the main method store your age in a variable named age. Then main should print out a line that has your name, followed by your age. (Use a ?string literal? for your name, but use the variable to access your age.)
public class Fred { public static void main(String[] args) { int age = 12; System.out.println("Fawzi Emad, age is " + age); } }
36
New cards
What are the two styles of java comments?
// one line comment /* multiple line comment */
37
New cards
Is the following statement valid: int x = 34.7;
no (type mismatch)
38
New cards
Is the following statement valid: double y = 12;
yes
39
New cards
Is the following statement valid: boolean q = 17 < 25;
yes
40
New cards
What does modulus do?
Return the remainder
41
New cards
Should you compare two strings with the == operator?
No
42
New cards
What should you do to compare two strings?
x.equals(y)
43
New cards
What is concatenation?
Joining two strings together
44
New cards
What operator do you use to concatenate Strings?
+
45
New cards
What are literals?
The actual value used in code
46
New cards
Give an example of a literal String?
"hi"
47
New cards
Give an example of a literal char?
'x'
48
New cards
Give an example of a literal long?
32L
49
New cards
Give an example of literal int?
16
50
New cards
Give an example of literal float?
15.7F
51
New cards
Give an example of literal double?
373.2
52
New cards
Give an example of literal boolean?
true
53
New cards
What is the "normal" base?
Base 10
54
New cards
How do you convert to different bases?
Divide by the base # into the base 10 number and put down the remainder from right to ledt\\ft
55
New cards
How do you convert from different bases back to base 10?
Multiply the number by the base value to the power of what position it is in
56
New cards
What are the important bases for CS?
2 (bianary) and 16 (hexadecimal)
57
New cards
What values can base 2 have?
1 and 0
58
New cards
What values can hexadecimal have?
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
59
New cards
Each digit in hex corresponds to exactly how many digits in binary?
4
60
New cards
How do you convert from hex to binary?
write each digit as it should be in binary and put them altogether
61
New cards
How do you convert from binary to hex?
Starting from the right break the number up into 4 digit chunks (pad to the left if needed), then determine the value and write it in hex
62
New cards
What is a CPU and what does it do?
Central Processing Unit, it is the brain of the computer and it runs the machine code. There are multiples cores and there are often 2 "threads" per core
63
New cards
What is RAM?
Random Access Memory or Primary Memory
64
New cards
What are Secondary Memory Devices?
Hard drives, Solid state drives, USB thumb drives, cd/dvd
65
New cards
How do input/output devices work? Give an example?
It is from the perspective of the computer. Keyboard is input.
66
New cards
Define bit?
A binary digit (a 0 or 1)
67
New cards
Define byte?
a sequence of 8 bits
68
New cards
Define ram?
a sequences of cells containing 8 bits
69
New cards
How many permutations can a cell in a ram hold?
2^8
70
New cards
What is the formula for finding the amount of permutations given k bits?
2^k
71
New cards
How many bytes is a kilobyte?
1024 bytes (kB) or 1000 bytes (kb)
72
New cards
How many bytes is a megabyte?
2^20 bytes (mB) or 1 million bytes (mb)
73
New cards
How many bytes is a gigabyte?
2^30 bytes (gB) or 1 billion bytes (gb)
74
New cards
How many bytes is a terabyte?
2^40 bytes (tB) or 1 trillion bytes (tb)
75
New cards
How are non-negative numbers stored?
They are converted to binary and then padded with leading 0s
76
New cards
How are negative numbers stored?
Using two's complement
77
New cards
Explain the method for turning a number into twos complement.
Turn the number into binary, pad with extra zeros to take up all the bits of space, flip the numbers and add 1
78
New cards
How are floating point numbers stored?
Basically they are stored in scientific notation
79
New cards
How is text stored?
It is stored in different formats based on context, however the old standard was ASCII and the new way is Unicode?
80
New cards
What does ASCII stand for?
American Standard Code for Information Interchange
81
New cards
Explain the difference between ASCII and Unicode and why we made the switch?
ASCII is only 1 byte per character v. Unicode which is two bytes per character (as per UTF-16 although there are different versions), which allows us to convey a wider range of symbols
Operation system + installed drivers manage technical operations when printing
87
New cards
What is machine language?
Also called machine code, machine language are primitive instructions that the computer knows how to do because the computer doesn't know java
88
New cards
What is assembly language?
It is the lowest language a human can understand easily, basically it is a "readable" machine language
89
New cards
What are some examples of higher level languages?
- C - C++ - Pascal - Ruby - Python - Java - Lisp - Cobol - Fortran
90
New cards
What are the two was high-level code is translated to machine code?
Compiled and Interpreted
91
New cards
How do compilers work? What are the pros and cons?
Compilers translate source code to an executable machine code file all at once (.exe on Windows, .dmg on macOS). The pro is that it is fast but it is not portable because your specific computer has to compile it so there are different versions for different operating systems
92
New cards
How do interpreters work? What are the pros and cons?
As the program is running, the code is translated line-by-line live. The pro is that it is portable because the source code is the same for everyone as long as they have an interpreter. The cons are that it takes a little longer because it requires CPU time
93
New cards
How does Java run a program?
Java uses a compiler and interpreter. Essentially, Java compiles the source code into a universal bytecode file which is easily portable. When the bytecode file is ran, it is interpreted line by line
94
New cards
What is the vague definition of a Object?
things that interact with each other (nouns)
95
New cards
What is the vague definition of a Class?
a description of an Object (definition)(blueprint)
96
New cards
What is the vague definition of a Method?
A chunk of code that has a name
97
New cards
What is the main method?
Where the program starts
98
New cards
What are statements?
A series of instructions that are sequential but not connected