2.2 - Programming fundamentals Flashcards
(31 cards)
What is a variable in programming?
A variable is a named storage location in memory that holds a value which can be changed during program execution.
What is a constant in programming?
A constant is a named value that cannot be altered during the execution of a program.
What are the three basic programming constructs?
Sequence, Selection, and Iteration.
Define ‘sequence’ in programming.
Sequence is the execution of code statements one after another in the order they appear.
Define ‘selection’ in programming.
Selection is making decisions in code using conditions, typically implemented with if, else-if, and else statements.
Define ‘iteration’ in programming.
Iteration is the repetition of a set of instructions until a condition is met, implemented using loops like for and while.
What are common arithmetic operators in programming?
Addition (+), Subtraction (-), Multiplication (*), Division (/), Modulo (MOD), Quotient (DIV), and Exponentiation (^).
What are common Boolean operators in programming?
AND, OR, and NOT.
What is the purpose of using variables and constants?
They allow programmers to store and manipulate data within a program efficiently.
What is an integer data type?
An integer is a whole number without a fractional component.
What is a real data type?
A real number is a number that can have a fractional component, also known as a float.
What is a Boolean data type?
A Boolean represents one of two values: true or false.
What is a character data type?
A character is a single letter, digit, or symbol.
What is a string data type?
A string is a sequence of characters.
What is casting in programming?
Casting is converting a variable from one data type to another.
Why is casting useful?
It allows for data type compatibility and proper manipulation of different data types.
What is string concatenation?
Combining two or more strings end-to-end to form a new string.
What is string slicing?
Extracting a substring from a string using specified start and end positions.
What are basic file handling operations in programming?
Open, Read, Write, and Close.
What is a record in programming?
A record is a data structure that groups related fields, each with potentially different data types.
What is SQL?
Structured Query Language, used to manage and query relational databases.
What are basic SQL commands?
SELECT, FROM, WHERE.
What is an array in programming?
An array is a data structure that holds a fixed number of elements of the same data type.
What is a one-dimensional array?
An array with a single row of elements.