Introduction to Programming
- 62Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is programming in simple terms?
Getting a computer to complete a specific task without mistakes by giving it precise instructions.
Or swipe the card
62 cards
What is programming in simple terms?
Getting a computer to complete a specific task without mistakes by giving it precise instructions.
What language does a computer understand directly?
Machine code, which is binary (a series of 0s and 1s).
What is the role of a programming language?
It acts as a middleman that translates human-readable instructions into machine code.
What is the difference between high-level and low-level programming languages?
Low-level languages (e.g., Assembly, C) are closer to machine code; high-level languages (e.g., Python, Java) are more abstract and further from machine code.
What is an IDE?
Integrated Development Environment: a graphical interface for writing, running, and debugging code, with tools like error checking, auto-fill, and project hierarchy.
What is syntax in programming?
The set of rules (grammar) that must be followed when writing code in a programming language.
What is the console used for in programming?
A text interface to output information from a program, primarily using print statements for debugging and viewing results.
How does a print statement work in Python to output text?
Example:
print("Hello World")prints the text to the console.What is the modulus operator?
It returns the remainder of a division operation (e.g., 10mod3=1).
What is concatenation of strings?
Combining strings and other data using the
+operator (e.g.,"Game over, " + score + " was your final score").What is the difference between "4" (in quotes) and 4 (without quotes) in programming?
"4" is a string; 4 is an integer. They are treated differently and cannot be used interchangeably in arithmetic.
What is a variable?
A storage location in memory that holds a value, which can be referenced and manipulated. It has a type, name, and value.
List five primitive variable types.
Integer (int), Boolean (bool), Float, Double, Character (char), and String (though String is often not primitive).
What is the range of an integer variable in many languages?
From −2,147,483,648 to 2,147,483,647.
What is the difference between float and double?
Float is 32-bit precision; double is 64-bit precision (can store more decimal places).
What is a Boolean variable?
A variable that can only store
trueorfalse.What is a char variable?
A variable that holds a single character (e.g., 'a', '1').
What is camelCase naming convention?
Writing variable names without spaces, capitalizing the first letter of each word after the first (e.g.,
playerScore).What happens if you reference a variable that has no value?
You get a NullPointerException error.
How can you make a variable without initializing it?
Declare it without assigning a value (e.g.,
int x;in Java).How do you assign one variable to another?
Set it equal to the other variable (e.g.,
channelName = name;), making both point to the same memory location.What is the purpose of an if statement?
To execute a block of code only if a specified condition (boolean expression) is true.
What is the difference between if, else if, and else?
If checks a condition; else if checks additional conditions only if previous ones were false; else executes if no previous conditions were true.
What is a switch statement?
A conditional statement that tests a variable against multiple cases, executing code for the matching case, with a default case for no match.
What is a for loop?
A loop that repeats a block of code a specific number of times, typically with an initialization, condition, and increment/decrement.
What is a for-each loop?
A loop that iterates over each element in an array or collection without explicit indexing.
What is a while loop?
A loop that repeats a block of code as long as a condition is true.
What is a do-while loop?
Similar to a while loop, but the code block executes at least once before checking the condition.
What is an infinite loop?
A loop whose condition never becomes false, causing the program to run indefinitely (and often crash).
What is an array?
A fixed-size collection of elements of the same type, accessed by index starting at 0.
What is the index of the first element in an array?
What happens if you try to access an array element beyond its size?
You get an 'out of bounds' error.
Can the size of an array be changed after initialization?
No, the size is fixed once the array is created.
What is a two-dimensional array?
An array of arrays, like a matrix with rows and columns.
What is an ArrayList?
A dynamic array that can grow in size automatically when elements are added.
What is a dictionary (or map)?
A data structure that stores key-value pairs, where each key is unique and used to retrieve its associated value.
What is a function?
A reusable block of code that can be called by name, optionally taking arguments and returning a value.
What are arguments in a function?
Variables passed into the function to be used within its code.
What is a void function?
A function that does not return any value.
When defining a function that returns a value, what must be ensured?
All possible code paths must return a value of the specified type.
What is an import statement used for?
To bring in functions from external libraries or packages into your code.
Why should you import only specific functions rather than an entire library?
It reduces computational load and improves program efficiency, especially in large projects.
What is recursion?
A programming technique where a function calls itself.
What is a base case in recursion?
A condition that stops the recursive calls, preventing infinite recursion.
What is a stack in programming?
A data structure that stores function calls or tasks, using LIFO (Last In, First Out) order.
What is a stack overflow error?
Occurs when the stack exceeds its allocated memory, often due to infinite recursion or too many nested calls.
What is linear search?
A search algorithm that checks each element in a list sequentially until the target is found or the list ends.
What is binary search?
A search algorithm that repeatedly divides a sorted list in half, comparing the middle element to the target.
What does Big O notation represent?
A measure of algorithm efficiency, specifically the worst-case number of operations as a function of input size n.
List three types of programming errors.
Syntax errors, runtime errors, and logic errors.
What is a syntax error?
An error caused by violating the grammar rules of the programming language (e.g., missing semicolon).
What is a runtime error?
An error that occurs while the program is running, such as an infinite loop or division by zero.
What is a logic error?
An error where program runs without crashing but produces incorrect results due to flawed reasoning.
What is a breakpoint in debugging?
A marker placed on a line of code that pauses program execution when reached, allowing inspection of variables.
How can commenting code help with debugging?
Temporarily disabling sections of code to isolate the source of an error without deleting it.
What is pseudocode?
An informal, human-readable description of a program's steps, focusing on logic rather than syntax.
Name three pseudocode strategies mentioned.
Flowcharts, chronological write-up, and feature/functionality planning.
What is a flowchart used for in planning?
Graphically representing the flow of a function using blocks and arrows to show decision paths.
What is the difference between a general-purpose language and a scripting language?
General-purpose languages (e.g., Python, Java) have wide applications; scripting languages (e.g., JavaScript, PHP) are often used for web tasks and have many built-in commands.
Name three general-purpose programming languages.
Java, Python, C++.
What are HTML and CSS used for?
HTML for structuring web content, CSS for styling.
List three websites mentioned for practicing programming.
CodingBat, CoderByte, HackerRank.

Ask anything
We've read this whole study set, so questions about it get the best answers.