Intro To Programming Flashcards

1
Q

What are the steps in the 5-Step Process?

A

Identify, Analyze, Develop, Implement, and Evaluate.

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

Before a code can run, it must be..? It is reduced to…?

A

Compiled.

0s and 1s.

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

The character variable is written as…? And how many characters can it hold? What kind of quotes are around it?

A

char.
Can only hold one character.
Single quotes.

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

String variables have what kind of quotes around it?

A

Double quotes.

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

What are escape characters?

A

They tell C# to treat the next character as part of the string.

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

What kinds of numeric data are there? How many places can it hold?

A

Int and float and double.
int - whole numbers.
float - 7 places.
double - 15 places.

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

What are variables?

A

They are the storage containers of the programming world.

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

What kind of notation is used with variables?

A

camelCase.

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

Which words cannot be used in a variable?

A

with, for, if or break.

as well as any numbers or special characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
In
string courseName = "ITP";
what kind of variable is this?
what is the variable name?
what is the assignment operator?
the value...?
A

It is a string variable.
The variable name is courseName.
The “=” sign is the assignment operator.
“ITP” is the value.

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

What is an operator?

A

They are used to perform mathematical logical operations.

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

What is a modulo? What sign does it use?

A

It finds the remainder after the division of one # by another. It uses the % sign.

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

What does an increment look like? Decrement?

A

++ and –.

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

Do function and method mean the same thing?

A

Yes, but what we call them depends on the language and location. If it’s declared outside an object, it’s a method.

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

In

private static void Print (string value)
{
Console.WriteLine(value);
}

Where is the access modifier?
Where is the "other" modifier?
Where is the return type?
Where is the Identifier?
Where is the parameters?
A
The access modifier is private.
The "other" modifier is static.
The return type is void.
The Identifier is Print.
The parameters is (string value).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a method?

A

A block of statements under the signature.

17
Q

What kind of values can the return value be?

A

It can be a literal, variable, constant, expression, or statement result.

18
Q

What are some of the common errors in writing a code?

A
  • declaring a method inside another’s body.
  • mismatching/miscounting ( ) and { }.
  • placing a semicolon at the end of the signature or body.
  • mismatching/miscounting argument/parameter type/ order.
19
Q

How do write a boolean variable and what is it?

A

bool.

and it holds a True or False value.

20
Q

How do write equality and inequality?

A

== and !=

21
Q

What is the difference between equality and assignment?

A

== means that it’s comparing two values.

= means that you are storing a value.

22
Q

In an If statement, how does it run?

A

The contents of the parenthesis will be evaluated to a boolean value, either true or false.
If the condition is true, then the statement block runs, otherwise, it is ignored.

23
Q

How do else statements run?

A

In a simple if, else conditional block, if the first condition is false, then the second block of code will be executed.

24
Q

Can you use multiple else statements?

A

Yes, you can.

25
Q

What is a nested conditional statement?

A

It is when one decision is dependent on another.

26
Q

What are the two conditional logical operators?

A

&& and ||.

27
Q

What are the three types of code in loops?

A

Sequential, Conditional, and Repetitive.

28
Q

What is the difference between a while loop and a for loop?

A

The while loop checks to see if a condition is true or false. The code block runs until the condition is false.

A for loop customizes the initialization.

29
Q

What is an array?

A

A straightforward way of storing a bunch of items together. Often used to store the same type.

30
Q

What are the steps of setting an array?

A
  • The variable’s default is null.
  • Memory for the array is allocated.
  • Then, the elements are initialized to the type’s default or the provided value.
  • The variable’s value now refers to that memory, which means it is no longer null.
31
Q

What do the [ ] do?

A

It moves you to the next/previous element in sequence.

32
Q

What happens if member access is attempted when the variable referencing is null?

A

A NullReferenceException is thrown.

33
Q

What happens if element access is attempted beyond the bounds of the array? (either too high or too low)

A

An IndexOutOfRangeException is thrown.

34
Q

What is declaration without initialization?

A

When we don’t yet know the size or values but need the variable.

35
Q

What is initialization of an existing variable?`

A

When we know the size, but not the values. This will allocate the memory and initialize to the type’s defaults.

But it is also when we know the size as well as the values , this will allocate the memory and initialize using the initializer list we provide.

36
Q

How do we update elements in an array?

A
  • numbers [0] = 9;

- words [0] = “see”;

37
Q

How to we read elements in an array?

A

Console.WriteLine(numbers[0]);
int i = numbers[1];
i += numbers [2]’

OR

Console.WriteLine($”C# is pronounced: "{words[0]} {words[1]}");

38
Q

What are some of the common errors when writing arrays?

A
  • forgetting [ ] or { } or new
  • mismatching [#] and {#} counts
  • confusing length (total items) and array elements access (0-based), leads to off by one errors