GoConqr has a new look! Let us know what you think.

Quiz

C# Programming Quiz

Mr Killer 9 questions Updated 24 Apr 2017

Take the quiz

This quiz has a time limit, so it opens in the usual player.

Questions in this quiz (9)

  1. 1What is wrong with the following code?

    uint number1 = -27;
    1. AUnsigned variables cannot hold negative numbers
    2. BThere is no such thing as a uint
    3. Cnumber1 variable ends with a number and this is invalid in C#
    4. DThere is nothing wrong with the code
  2. 2Is this valid C# code?

    enum Months {January, February, March, April, May, June, July, August, September, October, November, December};
    Months currentMonth = April;
    1. ATrue
    2. BFalse
  3. 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].
    1. Acomment
    2. Bcomment
  4. 4The character used to move onto the next line in a Console.WriteLine command is an [blank_start]\n[blank_end]
    1. A\n
  5. 5What is wrong with the following code?

    int loopTerminator = 1;
    while(loopTerminator > 0)
    {
    loopTerminator = loopTerminator + 1;
    }
    1. AThe while loop will never meet it's stopping condition hence will go on forever
    2. BYou cannot assign a variable to it's self. The code should use loopTerminator++ instead;
    3. CThe code will not compile since there is no space between while and the brackets
    4. DThere is nothing wrong with the code
  6. 6What is the difference between an array and a list
    1. AArrays are a fixed size that must be declared upon it's creation, lists are no fixed size
    2. BLists are a fixed size that must be declared upon it's creation, arrays are no fixed size
    3. 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
    4. DArrays are limited to storing int, bool and strings. They cannot store object classes whereas lists can
  7. 7Methods are useful in order for...
    1. AAvoiding having to write the same code more than once
    2. BCreating a more efficient program
    3. CAllowing the compiler to generate code for you automatically
    4. DMethods allow you to access variables that may not be accessible outside of the method
  8. 8What is a constructor?
    1. AIt is called when a class object is created and usually initialises all the starting variable values
    2. BIt is is a special type of method that can be called in your code
    3. CIt is a process that must be completed before an array can be used
    4. DIt is part of the compilation process where the compiler constructs the .exe file to launch the program
  9. 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;
    }
    1. ACode B will not compile because switch statements can't be used for integer variables
    2. BCode B will print Yo to the Console under different circumstances to Code A
    3. CThey both behave in exactly the same way
    4. DThere is a chance that Code B will print both Yo and Hello whereas this is not possible with Code A

Information

Description
GCSE Computer Studies Quiz on C# Programming Quiz, created by Mr Killer on 24/03/2017.
Author
Mr Killer
Language
English
Views
0
History
Created on 24 Mar 2017 · updated on 24 Apr 2017
Tags
computer studiesgcse
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?