All flashcards
Flashcard 1: What keyword is used to declare a variable in JavaScript?
Answer: var, let, or const. JavaScript variable declaration keywords.
Flashcard 2: What is the result of the expression '10 - 2 * 5'?
Answer:
- Order of operations: 10โ(2ร5)=0.
Flashcard 3: What is a variable in programming?
Answer: A named storage location for data. Variables store values that can change during program execution.
Flashcard 4: Identify the error: int x = '3';
Answer: Incorrect type; use int x = 3;. Single quotes denote characters, not integers.
Flashcard 5: What symbol is used for assignment in most programming languages?
Answer: The equals sign (=). Assignment operator stores values in variables.
Flashcard 6: Identify the error: double y = 5.5.5;
Answer: Syntax error; use double y = 5.5;. Double decimal point makes number invalid.
Flashcard 7: What is the result of 'x = 10 % 3;'?
Answer:
- Modulus returns remainder: 10รท3=3 remainder 1.
Flashcard 8: What does 'String name = "John";' do?
Answer: Assigns "John" to the variable name. String variable declaration and initialization.
Flashcard 9: Find the value of y after: int y = 7; y -= 2;
Answer:
- Subtraction assignment: 7โ2=5.
Flashcard 10: What type of error occurs when dividing by zero?
Answer: Arithmetic error. Division by zero is mathematically undefined.
Flashcard 11: What is the scope of a variable declared inside a function?
Answer: Local to that function. Function variables exist only within that function.
Flashcard 12: What is a constant in programming?
Answer: A variable with a fixed value. Constants cannot be modified after initialization.
Flashcard 13: What is the difference between 'int' and 'double'?
Answer: 'int' is for integers; 'double' is for decimals. Different data types for whole vs decimal numbers.
Flashcard 14: What is the output type of 'x / y' if x and y are int?
Answer: int. Integer division truncates decimal portion.
Flashcard 15: Which statement correctly assigns a value to a variable?
Answer: x = 5;. Proper assignment syntax with equals operator.
Flashcard 16: What does 'x -= 5;' do to x?
Answer: Decreases x by 5. Compound subtraction assignment operator.
Flashcard 17: What is the outcome of '3.0 / 2' in programming?
Answer: 1.5. Double division produces decimal result.
Flashcard 18: Which data type would you use for a list of values?
Answer: Array or List. Data structures for multiple related values.
Flashcard 19: Identify the error: int x = '3';
Answer: Incorrect type; use int x = 3;. Single quotes denote characters, not integers.
Flashcard 20: Find the value of y after: int y = 7; y -= 2;
Answer:
- Subtraction assignment: 7โ2=5.
Flashcard 21: What is concatenation in programming?
Answer: Joining two strings together. String concatenation combines text values.
Flashcard 22: Which data type would you use for a true/false value?
Answer: Boolean. Boolean stores only true or false values.
Flashcard 23: What is the outcome of '3.0 / 2' in programming?
Answer: 1.5. Double division produces decimal result.
Flashcard 24: Which statement defines a variable in Python?
Answer: x = 10. Python uses simple assignment without type keywords.
Flashcard 25: Which data type would you use for a list of values?
Answer: Array or List. Data structures for multiple related values.
Flashcard 26: What happens if you exceed the range of an int variable?
Answer: Overflow occurs. Values wrap around when exceeding maximum range.
Flashcard 27: What is the result of the expression '10 - 2 * 5'?
Answer:
- Order of operations: 10โ(2ร5)=0.
Flashcard 28: What is the purpose of a variable declaration?
Answer: To specify a variable's type and name. Establishes variable name and data type.
Flashcard 29: Find the value of x after: int x = 5; x += 3;
Answer:
- Addition assignment operator: 5+3=8.
Flashcard 30: What is the scope of a variable declared inside a function?
Answer: Local to that function. Function variables exist only within that function.