SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start

level: General

Questions and Answers List

level questions: General

QuestionAnswer
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 arrayint[,] array = new int[x, y];
State how to declare an array of integersint[] array = new int[6];
How would you acess the eleemts of a text filestring 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 functionx: 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 stringstring Str = new string; Str[position]
How would you program a substring Substrings
What is meant by a subroutineA 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 concatenationJoining two or more strings together
Can you say the 4 types of programming paradigm?Imperative / procedural Functional Declarative Object oriented