Unit 1 Rob Flashcards

1
Q

What is a variable?

A

Variables are data values that can change when the user is asked a question, for example, their age.

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

Constants in C#

A

Constants can NOT change whilst the program is running, e.g const int passMark= 40;

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

What are the most common data types and what it does

A

boolean - true/false
Character - Single character
date/time - date and/or time
double - a number with a decimal such as 2.3
floating point. a number with a decimal e.g 4.5f
integer - A whole number
string - holds zero or more characters such as letters, numbers, spaces etc.

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

What are the there basic programming constructs:?

A

Sequence - the order in which instructions occur and are processed (order)

Selection - determines which path a program takes when it is running (IF)

Iteration - is the repeated execution of a section of code, when a program is running(LOOP)

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

What are the four basic programming operators?

A

Logical - AND OR NOT
Comparison - == = >= < ! =
Assignment - =
Arithmetic - + - * / DIV MOD

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

What is a sequence?

A

Sequence is the order in which instructions occur and are processed and if no conditions they’re done in order

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

What is a selection?

A

A selection determines which path a program takes when it is running, so the user is asked a question and if its answer is yes it will do 1 task and if the answer is no it will do another different task depending on the answer something will be done.

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

Iteration

A

Iteration is the repeated execution of a section of code when a programming is running until its complete (LOOP).

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

What is a logical operator?

A

AND OR NOT

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

What is a Comparison/relational operator?

A

== =>= < !=

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

What is an assignment operator?

A

=

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

What is an arithmetic operator?

A

+ - * / DIV MOD

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

What is readability?

A

refers how easy it is to read and understand code

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

What are the different types that help with readability?

A

Comments
Indentation
Naming

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

What is a comment?

A

Codes can be used to explain C# and to make it more readable, any text between // and the end of the line is ignored by C# and is just some text to help understand the code, and will not be executed.

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

What is indentation?

A
Indentation is the space between lines when coding and this saves lots of time while we revisit the code and use it, and this is because it allows the user to read it more quicker and understand it quicker e.g 
IF (you're reading this)
{              
            then stop   
}
Instead of doing this, 
IF (you're reading this) {then stop}
ALL in the same line
17
Q

What is naming?

A

naming is basically as the name says, give meaningful names to variables, programs etc. because it allows the programmer to read the code faster when he’s searching for a variable than a random variable name.

18
Q

What is a function?

A

On programming, there are often sections of the program that we want to re-use or repeat, “chunks” of instructions can be given a name, they are called functions and procedures.

19
Q

What is declaring?

A

A function declaration tells the compiler about a function’s name, return type if any and parameters.

20
Q

What is calling?

A

When a program calls a function, the program control is transferred to the called function. A called function performs a defined task.

21
Q

What is validation?

A

Is an automatic computer check to ensure that the data entered is sensible and reasonable, for example the computer can be programmed to only accept numbers between 11 and 16 and that’s called range check.

22
Q

Different types of validation

A

Length
Presence
Range
Format

23
Q

What is length validation

A

The computer is programmed to check the data isn’t too short or too long

24
Q

What is presence validation?

A

The computer checks whether a value is there or not, so maybe != null

25
Q

What is range validation?

A

The computer checks that a value falls within the specified range, for example the computer can be programmed to accept numbers between 1-100 and it checks if the user did so do that.

26
Q

What is format validation?

A

Format/data type validation is where the computer is programmed to check the data is in the right format, so int with whole numbers and float with decimals.

27
Q

What is defining?

A

Defining is actually providing the actual body of the function/variable where as declaring you are only declaring its name, value and if any parameters without the actual body.