What is a function? | A method that returns a value |
What is a procedure? | A method that does not return a value |
If you were to want a random number between 0 and 10, how would you go about programming one? | Random random = new Random();
int randomNumber = random.Next(0, 10);
Console.WriteLine(randomNumber); |
State how to declare a 2D array | int[,] array = new int[x, y]; |
State how to declare an array of integers | int[] array = new int[6]; |
How would you acess the eleemts of a text file | string filename = "FILENAME.txt";
StreamReader sr = new StreamReader(filename);
while ((line = sr.ReadLine()) != null)
{
line = each line of text file
}
sr.Close(); |
What does the '%' operand do? | Gives the remainder of a division of two numbers |
What does an integer '/' operand do? | Divides two integers and rounds towards zero to give an integer |
Math.Round(x,y,z)'
What are the variables for x y and z
What do they represent in the rounding function | x: Decimal number to be rounded
y: Integer, number of decimal places
z: Mode, Specification for how to round x if it is midway between two other numbers |
Porgram how to get the poisition of an element of a string | string Str = new string;
Str[position] |
How would you program a substring
Substring | s |
What is meant by a subroutine | A named block of code containing a set of instructions desgined to perform a frequenctly use operation |
What are two advantages of constants over hard coded values? | Constants can be given names so are easier to for a human to read
Constants only need updating at one position in the code |
What is meant by concatenation | Joining two or more strings together |
Can you say the 4 types of programming paradigm? | Imperative / procedural
Functional
Declarative
Object oriented |