ECE115

149 flashcardsby Ralitsa
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
What does computing even mean?
Computing refers to performing systematic logical and arithmetic operations to process, store, and retrieve data.
2
Why do we use base 10 (decimal) in everyday life?
Decimal is historically rooted in human anatomy, as humans typically have ten fingers.
3
Why perform computation in binary (base 2)?
Binary uses only two states—0 and 1—corresponding to OFF/ON or LOW/HIGH voltage levels, making hardware simpler, reliable, and efficient.
4
What did the term 'computer' mean in the 1800s?
It referred to humans, often women, who performed complex mathematical calculations manually.
5
What was Charles Babbage's main motivation for developing a mechanical computer?
Babbage aimed to reduce errors in manual calculations and automate mathematical computations to save time and improve reliability.
6
Why do we perform computations in electrical forms instead of mechanical forms?
Electrical systems enable faster, more reliable, and scalable computations compared to mechanical systems.
7
What are the two main inventions that revolutionized computing?
The transistor (1947), which replaced vacuum tubes, and the integrated circuit (1958), which combined multiple transistors into a chip.
8
What’s the benefit of a transistor over a vacuum tube?
Transistors are smaller, consume less power, and are more reliable than vacuum tubes.
9
Why do computational demands increase over time?
Technological advancements, user expectations for faster devices, and innovations in software require increasingly powerful systems.
10
When will we have enough computation? How much is enough?
There is no definitive endpoint for computational requirements. As technology evolves, new challenges emerge that demand more powerful computing systems. Examples include quantum computing for cryptography and AI for healthcare.
11
How do you define a computer?
A programmable electronic device that processes data by executing instructions and consists of hardware and software.
12
State two examples of input devices.
Keyboard and Mouse.
13
State two examples of output devices.
Monitor and Printer.
14
What does 'CPU' stand for? What is the role of the CPU?
CPU stands for Central Processing Unit. It executes instructions, processes data, and manages tasks in the computer system.
15
Why do modern computers need 'memory'?
Memory is needed to temporarily store data and instructions for quick access by the CPU, ensuring efficiency during computations.
16
What does ALU stand for? Where do the terms "Arithmetic" and "Logic" come from?
ALU stands for Arithmetic Logic Unit. Arithmetic refers to mathematical operations, and Logic refers to comparison operations.
17
What parameters distinguish different CPUs? State two parameters.
Clock Speed and Number of Cores.
18
What does ISA stand for? What does it mean?
ISA stands for Instruction Set Architecture. It defines the set of commands a CPU can execute, forming the interface between hardware and software.
19
Why do we need both RAM and SSD?
RAM provides temporary, fast storage for running applications, while SSD provides long-term, non-volatile storage for data and applications.
20
What does memory hierarchy mean? How can it improve performance? Make a real-life analogy.
Memory hierarchy organizes storage devices based on speed, cost, and capacity. It improves performance by storing frequently accessed data in faster layers. Analogy: Your desk (RAM) holds immediate-use items, while filing cabinets (SSD) store less frequently used documents.
21
How many different things can you encode with n bits?
With n bits, you can encode
2
𝑛
2
n
different things.
22
What does a program mean?
A program is a set of instructions written in a specific programming language to perform a task.
23
What does software mean?
Software refers to programs and operating systems that control hardware and allow users to perform tasks.
24
What is an operating system?
An operating system (OS) is the software that manages hardware resources and provides an interface for user interactions.
25
State two roles of the operating system.
Resource Management and User Interaction.
26
What does 'standard input' refer to? What does 'standard output' refer to?
Standard input refers to the keyboard; standard output refers to the monitor.
27
What does 'GUI' stand for? What does it mean?
GUI stands for Graphical User Interface. It allows users to interact with computers using visual elements like windows and buttons.
28
What does 'CLI' stand for? What does it mean?
CLI stands for Command Line Interface. It allows users to interact by typing text-based commands into a terminal.
29
What does the drone hovering condition mean?
The drone hovers when the upward thrust equals the gravitational pull acting on it.
30
Why do we need propellers on a drone?
Propellers generate lift to overcome gravity and control the drone's movement.
31
How could a drone fly upwards?
By increasing the speed of all propellers to generate more thrust than gravity.
32
How could it move left or right?
By varying the speed of specific propellers to tilt the drone in the desired direction.
33
How could it land?
By gradually reducing the propeller speed so that thrust becomes less than gravity.
34
Why do the rotational directions of propellers matter for stable flight operation?
Opposite rotational directions counteract torque effects, preventing the drone from spinning uncontrollably.
35
What does "Abstraction" mean? How is it useful?
Abstraction hides complex details, allowing users to focus on high-level functionality, such as controlling a drone with simple commands.
36
What does programming mean?
Programming is creating a set of instructions that a computer can execute to perform specific tasks.
37
Why do we need programming languages?
They simplify instructions for humans and reduce errors compared to writing machine code.
38
What does "machine code" or "object code" mean?
Binary instructions directly executed by the CPU.
39
What is the difference between a high-level and a low-level programming language?
High-level languages are human-readable and portable; low-level languages are closer to machine code and hardware-dependent.
40
Which one is portable? Which one is more human-readable?
High-level languages are portable and human-readable.
41
What is the difference between a compiler and an interpreter?
A compiler translates the entire code before execution, making it faster; an interpreter translates and executes line-by-line, making it interactive.
42
What does Java's "WORA" concept mean?
"Write Once, Run Anywhere" enables Java programs to run on any platform with a JVM.
43
What was the main motivation behind Java's invention?
The rise of the internet and the need for platform-independent web applications.
44
Define terms associated with programming languages: Universality (Turing Completeness), Syntax, Semantics.
Universality: Ability to simulate any computation. Syntax: Rules for writing code. Semantics: Meaning of instructions.
45
How does Java aim to implement the "WORA" concept?
Java uses bytecode and the JVM to achieve platform independence.
46
What is the name of the Java compiler?
The Java compiler is called javac.
47
What does a bytecode mean?
Bytecode is intermediate code generated by the compiler, executed by the JVM.
48
What does JVM stand for? What is its job?
JVM stands for Java Virtual Machine, which executes Java bytecode.
49
What does an IDE stand for? What’s its job?
IDE stands for Integrated Development Environment, which simplifies development with tools like debugging and code generation.
50
What does a Java package mean?
A collection of related classes organized for reusability and to prevent naming conflicts.
51
Which package is imported by default?
The java.lang package.
52
What does "import java.util.ArrayList;" do?
It imports the ArrayList class from the java.util package.
53
What does "import java.util.*;" do?
It imports all classes from the java.util package.
54
What is the purpose of adding comments to code?
To improve readability and document the code.
55
What does an algorithm mean?
An algorithm is a set of well-defined instructions or steps designed to solve a specific problem or perform a task.
56
What are the three basic control structures for implementing an algorithm?
Sequencing, Selection, and Repetition.
57
What does sequencing mean?
Sequencing is the execution of instructions in the order they appear, like adding two numbers and displaying the result.
58
What does selection mean?
Selection involves decision-making based on conditions, such as using an if-else statement to check whether a number is even or odd.
59
What does repetition mean?
Repetition is executing a block of code multiple times, such as using a for loop to print numbers from 1 to 5.
60
What are variables in Java?
Variables act as containers for storing data values that may change during program execution. For example: int age = 25; assigns the value 25 to the variable age. Local variables are not initialized automatically and must be explicitly assigned values.
61
What are constants in Java?
Constants store values that do not change during program execution. Declared using the final keyword. For example: final double PI = 3.14159; assigns a constant value of 3.14159 to PI.
62
What is the default value for instance variables in Java?
Instance variables have default values: int: 0, double: 0.0, char: 0000, boolean: false, and reference types: null.
63
What is the main motivation behind defining variables?
Variables allow for reusability, avoiding hardcoding values multiple times. They also enable efficient memory management by allocating specific storage for data.
64
What happens in hardware when we declare a variable?
Memory is allocated based on the data type. For example, declaring int i = 20; allocates 4 bytes of memory and stores 20 in binary: 00000000 00000000 00000000 00010100.
65
What does a data type mean?
A data type defines the kind of data a variable can store and the operations allowed on that data.
66
What are the two main data types in Java?
1. Primitive Types: Built-in types like int, double, char, boolean. For example: int number = 10;, double price = 19.99;. 2. Reference Types: Types created by the programmer or provided by Java, such as String, Array, Object.
67
How much memory does each Java data type use?
int: 4 bytes, double: 8 bytes, char: 2 bytes, boolean: 1 byte, short: 2 bytes, long: 8 bytes.
68
Is 5 the same as 5.0 in Java?
No, 5 is an int (integer) while 5.0 is a double (floating-point number).
69
What does variable declaration and assignment look like in Java?
Declaration: int score;. Assignment: score = 100;. Combined: int score = 100;.
70
How do you evaluate 1 + 3 * 4 % 3 in Java?
The output is 2. % (modulus) has higher precedence than + or *. Evaluate 3 * 4 % 3 → 12 % 3 = 0, then 1 + 0 = 2.
71
What is the difference between j = i++; and j = ++i;?
i++: Assigns i to j, then increments i. For example: int i = 5; int j = i++; // j = 5, i = 6. ++i: Increments i first, then assigns to j. For example: int i = 5; int j = ++i; // j = 6, i = 6.
72
What are shorthand operators in Java?
Shorthand operators combine assignment with operations. For example: int x = 5; x += 3; // Equivalent to x = x + 3;.
73
What does NaN mean in Java?
NaN stands for "Not a Number," representing undefined operations, like 0.0 / 0.0.
74
What does Infinity mean in Java?
Infinity results from division by zero, such as 1.0 / 0.0.
75
Why do we need ASCII? What standard does Java use for characters?
ASCII assigns numerical codes to characters, providing consistent encoding for text. Java uses Unicode, which includes ASCII and supports more global characters.
76
Why would opening an image in a text reader display gibberish?
Images are stored as binary data, not human-readable text. A text reader misinterprets binary data as characters, resulting in gibberish.
77
What is an Escape Sequence in Java?
Escape sequences are special character combinations beginning with \. For example, \n creates a new line in the output.
78
What does \n do in Java?
The \n escape sequence inserts a new line in the output. For example: System.out.println("Hello\nWorld");. Output: Hello (newline) World.
79
What is the type and value of ('b' - 'a') in Java?
Type: int. Value: 1 (ASCII value of 'b' is 98, 'a' is 97, so 98 - 97 = 1).
80
What are the results of bitwise operations on (6 | 8), (6 & 8), and (6 ^ 8)?
1. OR (|): Combines bits. 6 | 8 = 14 // Binary: 0110 | 1000 = 1110. 2. AND (&): Extracts common bits. 6 & 8 = 0 // Binary: 0110 & 1000 = 0000. 3. XOR (^): Identifies differing bits. 6 ^ 8 = 14 // Binary: 0110 ^ 1000 = 1110.
81
What are conditionals in Java?
Conditionals allow programs to make decisions based on specific conditions, enabling different execution paths.
82
What does the if statement do in Java?
The if statement executes a block of code if the condition evaluates to true. Example:
if (x > 0) { System.out.println("x is positive"); }
83
What does the if-else statement do in Java?
The if-else statement executes one block if the condition is true and another block if it is false. Example:
if (x > 0) { System.out.println("x is positive"); } else { System.out.println("x is not positive"); }
84
What does the if-else if ladder do in Java?
The if-else if ladder evaluates multiple conditions in sequence. Example:
if (x > 0) { System.out.println("x is positive"); } else if (x == 0) { System.out.println("x is zero"); } else { System.out.println("x is negative"); }
85
What are nested if-else statements in Java?
Nested if-else statements allow one conditional block to contain another. Example:
if (x > 0) { if (x % 2 == 0) { System.out.println("x is positive and even"); } else { System.out.println("x is positive and odd"); } }
86
What is the ternary operator in Java?
The ternary operator is a shorthand for if-else statements. Syntax: condition ? value_if_true : value_if_false. Example:
String result = (x > 0) ? "positive" : "not positive";
87
What does the switch statement do in Java?
The switch statement evaluates an expression and executes the matching case block. Example:
switch (day) { case 1: System.out.println("Monday"); break; case 2: System.out.println("Tuesday"); break; default: System.out.println("Invalid day"); }
88
What are compound boolean expressions in Java?
Compound boolean expressions combine conditions using logical operators like &&, ||, and !. Example:
if (x > 0 && y > 0) { System.out.println("Both x and y are positive"); }
89
How do you test equality for strings in Java?
Use .equals() instead of == for comparing strings. Example:
String a = "Hello"; String b = "Hello"; if (a.equals(b)) { System.out.println("Strings are equal"); }
90
What are loops in Java?
Loops allow repetitive execution of a block of code until a specified condition is met.
91
What does the while loop do?
The while loop repeats code as long as the condition is true. Example:
int i = 0; while (i < 5) { System.out.println(i); i++; }
92
What does the do-while loop do?
The do-while loop executes the code block at least once before checking the condition. Example:
int i = 0; do { System.out.println(i); i++; } while (i < 5);
93
What does the for loop do?
The for loop is used to iterate a specific number of times. Example:
for (int i = 0; i < 5; i++) { System.out.println(i); }
94
What does the enhanced for loop do?
The enhanced for loop iterates over elements in an array or collection. Example:
int[] numbers = {1, 2, 3}; for (int num : numbers) { System.out.println(num); }
95
What are nested loops?
Nested loops are loops inside another loop. Example:
for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { System.out.println("i = " + i + ", j = " + j); } }
96
What does the break statement do in loops?
The break statement exits the loop prematurely. Example:
for (int i = 0; i < 10; i++) { if (i == 5) { break; } System.out.println(i); }
97
What does the continue statement do in loops?
The continue statement skips the current iteration and moves to the next. Example:
for (int i = 0; i < 5; i++) { if (i == 2) { continue; } System.out.println(i); }
98
How can you find the maximum, minimum, and average of numbers using loops?
Example:
int[] numbers = {10, 20, 30}; int max = numbers[0], min = numbers[0], sum = 0; for (int num : numbers) { if (num > max) max = num; if (num < min) min = num; sum += num; } double avg = (double) sum / numbers.length;
99
How can you reverse a number using a loop?
Example:
int num = 12345, reversed = 0; while (num != 0) { int digit = num % 10; reversed = reversed * 10 + digit; num /= 10; } System.out.println("Reversed: " + reversed);
100
What is an array in Java?
An array is a data structure that stores multiple elements of the same data type in contiguous memory locations.
101
What are the default values for array elements in Java?
int: 0, double: 0.0, boolean: false, String or objects: null.
102
How do you declare and create an array in Java?
Declaration: int[] numbers;. Creation: numbers = new int[5];. Combined: int[] numbers = new int[5];.
103
How do you initialize an array with values in Java?
Syntax: int[] numbers = {1, 2, 3};.
104
How do you access and modify array elements in Java?
Access: int firstElement = numbers[0];. Modify: numbers[0] = 10;.
105
What is the syntax for a multi-dimensional array in Java?
int[][] matrix = new int[3][3];.
106
What is a shallow copy of an array?
A shallow copy copies the reference to the original array, not the elements. Example: int[] copy = original;.
107
What is a deep copy of an array?
A deep copy creates a new array and copies the elements. Example:
int[] copy = new int[original.length]; for (int i = 0; i < original.length; i++) { copy[i] = original[i]; }.
108
What is the difference between ArrayIndexOutOfBoundsException and NullPointerException?
ArrayIndexOutOfBoundsException occurs when accessing indices out of range. NullPointerException occurs when accessing an uninitialized array.
109
How can you sort and search an array in Java?
Sort: Arrays.sort(numbers);. Search: int index = Arrays.binarySearch(numbers, 3);.
110
What is a static method in Java?
A static method belongs to the class and can be called without creating an object. Example: Math.sqrt(4);.
111
Why use static methods in Java?
Static methods are used for class-level operations, reusability, and memory efficiency.
112
What is the syntax for a static method in Java?
public static returnType methodName(parameters) { // Code block }. Example: public static int square(int num) { return num * num; }.
113
What is the main method in Java?
The main method is the entry point of Java applications. Syntax: public static void main(String[] args) { // Code }.
114
What does the void return type mean in Java?
A method with void does not return a value. Example: public static void greet() { System.out.println("Hello!"); }.
115
What is function overloading in Java?
Function overloading allows methods with the same name but different parameter lists. Example: int multiply(int a, int b); double multiply(double a, double b);.
116
What is the scope of local variables in Java?
Local variables are accessible only within the method they are declared in. Example: public static void example() { int localVar = 10; }.
117
What does pass by value mean in Java?
For primitive types, only the value is passed, and changes do not affect the original variable. Example: modifyValue(original); // original remains unchanged.
118
What happens when reference types are passed in Java?
A copy of the reference is passed; changes to the object affect the original. Example: modifyArray(numbers); // Changes numbers[0].
119
What is recursion in Java?
Recursion is when a method calls itself to solve smaller instances of a problem. Example: public static int factorial(int n) { if (n == 1) return 1; return n * factorial(n - 1); }.
120
What is cryptography?
The practice of securing information through encryption to prevent unauthorized access.
121
What is a Caesar cipher?
An encryption algorithm that shifts each letter in the plaintext by a fixed number of positions in the alphabet. Example: HELLO shifted by 3 becomes KHOOR.
122
What does data compression mean?
Reducing the size of data to save space or improve transmission speed.
123
What are the types of data compression?
Lossless Compression (no data lost, e.g., ZIP files) and Lossy Compression (some data lost, e.g., MP3, JPEG).
124
What is an example of run-length encoding (RLE)?
Encoding repeated characters as a single character and count. Example: Input: AAAABBBCCDAA, Output: 4A3B2C1D2A.
125
What does image processing involve?
Manipulating images to improve quality or extract information.
126
What are pixels in image processing?
The smallest unit of an image, representing its color.
127
How much memory is needed for a 100x100 color image with 24-bit depth?
30,000 bytes (30 KB). Formula: width × height × color depth / 8.
128
What is audio processing?
Manipulating audio signals to improve quality or extract features.
129
What is the difference between sampling and quantization in audio processing?
Sampling converts continuous audio into discrete values at intervals, while quantization assigns numeric values to the sampled data.
130
Why do we need to compress data?
To save storage space, reduce bandwidth usage, and make large files more manageable.
131
Why do computers use binary representation?
Computers use binary because it aligns with their electrical states (1 = ON, 0 = OFF).
132
Why do computers use binary representation?
Computers use binary because it aligns with their electrical states (1 = ON, 0 = OFF).
133
What is a bit and a byte?
A bit is the smallest unit of data, representing 0 or 1. A byte consists of 8 bits and can represent values from 0 to 255.
134
What is an unsigned integer?
An unsigned integer represents non-negative numbers. Range for n bits: 0 to 2n−12^n - 12n−1.
135
What is the range of a 4-bit unsigned integer?
The range is 0 to 15.
136
What is a signed integer?
A signed integer can represent both positive and negative numbers. Common representations include Sign-Magnitude and Two's Complement.
137
What is Sign-Magnitude representation?
The MSB represents the sign (0 = positive, 1 = negative), and the remaining bits represent the magnitude. Example: +5+5+5 in 4 bits = 0101, −5-5−5 = 1101.
138
What is Two's Complement representation?
Two's Complement represents negative numbers by inverting the bits of the absolute value and adding 1. Example: +5+5+5 = 0101, −5-5−5 = 1011.
139
What is the range of a 4-bit signed integer in Two's Complement?
The range is −8-8−8 to 777.
140
What is the IEEE 754 standard?
The IEEE 754 standard defines the representation of floating-point numbers with Sign, Exponent, and Mantissa.
141
How is −5.75-5.75−5.75 represented in single-precision floating-point?
Sign = 1, Exponent = 130, Mantissa = Binary equivalent of 5.755.755.75.
142
What is the precision of single and double-precision floating-point numbers?
Single precision: 32 bits. Double precision: 64 bits.
143
Why do we use Two's Complement representation?
Two's Complement simplifies arithmetic and provides a unique representation for zero.
144
What is number overflow?
Overflow occurs when the result exceeds the range of the representation. Example: 4-bit unsigned 15+1=015 + 1 = 015+1=0, signed 7+1=−87 + 1 = -87+1=−8.
145
What is a DFA?
A Deterministic Finite Automaton is a theoretical machine used to recognize patterns in input strings.
146
What are the components of a DFA?
States, Alphabet, Transitions, Start State, Accept State(s).
147
What does the start state in a DFA represent?
The initial state where the DFA begins processing input.
148
What does the accept state in a DFA represent?
The state where the DFA accepts the input string.
149
How do you design a DFA to recognize "100"?
Use four states: q0 (start), q1, q2, and q3 (accept). Transitions: q0 -> q1 on 1, q1 -> q2 on 0, q2 -> q3 on 0.
Study all 149 cards for free