Quiz
C# Programming Quiz
Dieses Quiz hat ein Zeitlimit und öffnet sich deshalb im gewohnten Player.
Fragen in diesem Quiz (9)
1What is wrong with the following code?
uint number1 = -27;- AUnsigned variables cannot hold negative numbers
- BThere is no such thing as a uint
- Cnumber1 variable ends with a number and this is invalid in C#
- DThere is nothing wrong with the code
2Is this valid C# code?
enum Months {January, February, March, April, May, June, July, August, September, October, November, December};
Months currentMonth = April;- ARichtig
- BFalsch
3The // character is used to make a single line [blank_start]comment[blank_end] and the /* and */ is to start and end a multi line [blank_start]comment[blank_end].
- Acomment
- Bcomment
4The character used to move onto the next line in a Console.WriteLine command is an [blank_start]\n[blank_end]
- A\n
5What is wrong with the following code?
int loopTerminator = 1;
while(loopTerminator > 0)
{
loopTerminator = loopTerminator + 1;
}- AThe while loop will never meet it's stopping condition hence will go on forever
- BYou cannot assign a variable to it's self. The code should use loopTerminator++ instead;
- CThe code will not compile since there is no space between while and the brackets
- DThere is nothing wrong with the code
6What is the difference between an array and a list
- AArrays are a fixed size that must be declared upon it's creation, lists are no fixed size
- BLists are a fixed size that must be declared upon it's creation, arrays are no fixed size
- CYou must go through a list from top to bottom to find an element whereas an array can be accessed via a subscript such as array[2] for example
- DArrays are limited to storing int, bool and strings. They cannot store object classes whereas lists can
7Methods are useful in order for...
- AAvoiding having to write the same code more than once
- BCreating a more efficient program
- CAllowing the compiler to generate code for you automatically
- DMethods allow you to access variables that may not be accessible outside of the method
8What is a constructor?
- AIt is called when a class object is created and usually initialises all the starting variable values
- BIt is is a special type of method that can be called in your code
- CIt is a process that must be completed before an array can be used
- DIt is part of the compilation process where the compiler constructs the .exe file to launch the program
9What is the difference between Code A and Code B in terms of behaviour?
Code A:
int randomNumber = rand.Next(2);
if (randomNumber == 0)
{
Console.WriteLine("Yo");
}
else if (randomNumber == 1)
{
Console.WriteLine("Hello");
}
Code B:
int randomNumber = rand.Next(2)
switch (randomNumber)
{
case 0:
Console.WriteLine("Yo");
break;
case 1:
Console.WriteLine("Hello");
break;
}- ACode B will not compile because switch statements can't be used for integer variables
- BCode B will print Yo to the Console under different circumstances to Code A
- CThey both behave in exactly the same way
- DThere is a chance that Code B will print both Yo and Hello whereas this is not possible with Code A
Informationen
- Beschreibung
- GCSE Computer Studies Quiz am C# Programming Quiz, erstellt von Mr Killer am 24/03/2017.
- Autor
- Mr Killer
- Sprache
- English
- Aufrufe
- 0
- Verlauf
- Erstellt am 24 Mär 2017 · aktualisiert am 24 Apr 2017
- Schlagwörter
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz