Unit 1 SDD - Implementation - Computational Constructs Flashcards
What are keywords in programming?
Keywords are the actual commands that instruct the program to do something.
What are constructs in programming?
Constructs are groups of keywords that serve a specific purpose, such as IF…END IF for selection.
What is a variable in programming?
A variable is a storage location for data that can change during program execution.
What is assignment in programming?
Assignment is the process of storing a value in a variable using commands like SET.
What are operators in programming?
Operators are symbols or words that manipulate data, including arithmetic, comparison, and logical operators.
What is an expression in programming?
An expression is a combination of data, operators, and values that produces a final computed result.
What are arithmetic operators?
Arithmetic operators perform mathematical calculations: Addition (+), Subtraction (-), Multiplication (*), Division (/), Exponentiation (^).
What are comparison operators?
Comparison operators compare values and return TRUE or FALSE: = (equal to), > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to), != (not equal to).
What is an IF statement?
An IF statement executes a block of code only if a specified condition is TRUE.
What is an ELSE IF statement?
ELSE IF allows multiple conditions to be checked in an IF statement before reaching the final ELSE.
What are logical operators?
Logical operators allow multiple conditions to be combined: AND (both must be TRUE), OR (at least one must be TRUE), NOT (reverses truth value).
How does the AND logical operator work?
AND returns TRUE only if both conditions are TRUE.
How does the OR logical operator work?
OR returns TRUE if at least one of the conditions is TRUE.
How does the NOT logical operator work?
NOT inverts the truth value of an expression (TRUE becomes FALSE and vice versa).
What is a complex condition in programming?
A complex condition combines multiple expressions using logical operators for decision-making.
What is concatenation in programming?
The process of joining two or more strings together.
Which operator is used for concatenation in many programming languages?
‘&’ in some languages, ‘+’ in others like Python.
What is a selection construct in programming?
A structure that allows a program to make decisions, usually with IF statements.
What is the purpose of an IF statement?
To execute a block of code if a condition is TRUE.
How does an IF statement with ELSE work?
Executes the ELSE block if the IF condition is FALSE.
What are the two types of loops?
Fixed loops and conditional loops.
What is a fixed loop?
A loop that repeats a defined number of times.
What is a conditional loop?
A loop that repeats based on a Boolean condition.
What is an example of a fixed loop?
FOR counter FROM 1 to 10 DO … END FOR.
What is an example of a conditional loop?
WHILE score < 100 DO … END WHILE.
What is the difference between WHILE and REPEAT UNTIL loops?
WHILE checks the condition before execution, REPEAT UNTIL checks after execution.
What are predefined functions?
Built-in functions that perform common tasks.
What does the random function do?
Generates a pseudo-random number.
How do you generate a random integer between 1 and 10 in Python?
Use randint(1, 10) from the random module.
What does the round function do?
Rounds a real number to a specified number of decimal places.
What are the floor and ceiling functions?
Floor rounds down, ceiling rounds up.
How do you get the length of a string in Python?
Use the len() function.
What does the length function return?
The number of characters in a string.
How can you find the length of a concatenated name?
Use LENGTH(firstname & surname).