2.2 - Programming fundamentals Flashcards

(31 cards)

1
Q

What is a variable in programming?

A

A variable is a named storage location in memory that holds a value which can be changed during program execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a constant in programming?

A

A constant is a named value that cannot be altered during the execution of a program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the three basic programming constructs?

A

Sequence, Selection, and Iteration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define ‘sequence’ in programming.

A

Sequence is the execution of code statements one after another in the order they appear.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define ‘selection’ in programming.

A

Selection is making decisions in code using conditions, typically implemented with if, else-if, and else statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define ‘iteration’ in programming.

A

Iteration is the repetition of a set of instructions until a condition is met, implemented using loops like for and while.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are common arithmetic operators in programming?

A

Addition (+), Subtraction (-), Multiplication (*), Division (/), Modulo (MOD), Quotient (DIV), and Exponentiation (^).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are common Boolean operators in programming?

A

AND, OR, and NOT.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of using variables and constants?

A

They allow programmers to store and manipulate data within a program efficiently.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an integer data type?

A

An integer is a whole number without a fractional component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a real data type?

A

A real number is a number that can have a fractional component, also known as a float.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a Boolean data type?

A

A Boolean represents one of two values: true or false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a character data type?

A

A character is a single letter, digit, or symbol.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a string data type?

A

A string is a sequence of characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is casting in programming?

A

Casting is converting a variable from one data type to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Why is casting useful?

A

It allows for data type compatibility and proper manipulation of different data types.

17
Q

What is string concatenation?

A

Combining two or more strings end-to-end to form a new string.

18
Q

What is string slicing?

A

Extracting a substring from a string using specified start and end positions.

19
Q

What are basic file handling operations in programming?

A

Open, Read, Write, and Close.

20
Q

What is a record in programming?

A

A record is a data structure that groups related fields, each with potentially different data types.

21
Q

What is SQL?

A

Structured Query Language, used to manage and query relational databases.

22
Q

What are basic SQL commands?

A

SELECT, FROM, WHERE.

23
Q

What is an array in programming?

A

An array is a data structure that holds a fixed number of elements of the same data type.

24
Q

What is a one-dimensional array?

A

An array with a single row of elements.

25
What is a two-dimensional array?
An array with rows and columns, like a table.
26
What is a subprogram in programming?
A set of instructions designed to perform a frequently used operation, implemented as functions or procedures.
27
What is the difference between a function and a procedure?
A function returns a value after execution, while a procedure does not.
28
What are local variables?
Variables declared within a subprogram, accessible only within that subprogram.
29
What are global variables?
Variables declared outside any subprogram, accessible throughout the program.
30
Why use subprograms?
To improve code modularity, reusability, and maintainability.
31
What is random number generation in programming?
Creating a sequence of numbers that cannot be reasonably predicted, often used in simulations and games.