11.1 Programming.basics incompl Flashcards

1
Q

What is a constant in programming?

A

A named value that cannot change during the execution of a program. It must always be assigned a value when declared.

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

What is a variable in programming?

A

A named value that can change during the execution of a program. It is good practice to declare and initialise variables before use.

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

What is a library routine in programming?

A

A tested and ready-to-use routine available in the development system of a programming language that can be incorporated into a program.

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

What is a procedure in programming?

A

A set of statements grouped together that can be easily called in a program. Unlike a function, a procedure does not necessarily return a value.

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

What is a function in programming?

A

A set of statements grouped together that can be easily called in a program. Unlike a procedure, a function always returns a value.

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

Why is it good practice to assign initial values to variables and constants?

A

To ensure the programmer is certain of the starting values, preventing undefined behaviour during data manipulation.

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

How does Python handle constants and variables differently from other programming languages?

A

Python does not require separate declarations or enforce a distinction between constants and variables. Instead, assigning a value at the start ensures correct data type usage.

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

What are some examples of built-in mathematical functions in programming?

A

DIV(x, y) returns the integer part of a division (e.g., DIV(10, 3) → 3).
MOD(x, y) returns the remainder of a division (e.g., MOD(10, 3) → 1).

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

Why are strings useful in programming?

A

Strings are versatile for storing data and are commonly used for comparing data like passwords, usernames, and other textual information.

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

What are some examples of string manipulation functions in Python?

A

len(string) returns the length of the string.
string[0] accesses the first character.
string[-1:] accesses the last character.

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

What does an Integrated Development Environment (IDE) typically include?

A

An IDE usually includes:

  • A standard library of functions and procedures.
  • An interpreter and/or compiler.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly