Help shape GoConqr. What should we add next?

Quiz

C# Lesson Questions Part 2

April Rice 45 questions

Take the quiz

This quiz has question types that open in the usual player.

Questions in this quiz (45)

  1. 1What is the output of this code?

    static int Vol(int x, int y=3, int z=1) {
    return x*y*z;
    }
    static void Main(string[] args) {
    Console.WriteLine(Vol(2,4));
    }

    [blank_start]8[blank_end]
    1. A8
  2. 2Call the method using named arguments with the values 5 for "from",99 for "to" and 2 for "step":

    static int calc(int from, int to, int step=1) {
    int res=0;
    for(int i=from; i<to; i+=step=1) {
    res+=I;
    }
    return res;
    }
    static void Main (string[] args) {
    int res = [blank_start]clac[blank_end]( [blank_start]step:[blank_end] 2, [blank_start]to:[blank_end] 99, [blank_start]from:[blank_end] 5);
    Console.WriteLine(res);
    }
    1. Aclac
    2. Bstep:
    3. Cto:
    4. Dfrom:
  3. 3What is the output of this code?

    static void Test(int x) {
    x=8;
    }
    static void Main() {
    int a=5;
    Test(a);
    Console.WriteLine(a);
    }

    [blank_start]5[blank_end]
    1. A5
  4. 4Fill in the blanks to create a method that swaps the values of its two arguments.

    void Swap ([blank_start]ref[blank_end] int x, [blank_start]ref[blank_end] int y) {
    int temp;
    temp=x;
    x=y;
    y=[blank_start]temp[blank_end];
    }
    1. Aref
    2. Bref
    3. Ctemp
  5. 5Fill in the blanks to ask for user input in the method and return the value entered using output parameters.

    static void Ask( [blank_start]out[blank_end] string name) {
    [blank_start]name[blank_end] = Console.ReadLine();
    }
    static void Main(string[] args) {
    string nm;
    Ask([blank_start]out[blank_end] nm);
    }
    1. Aout
    2. Bname
    3. Cout
  6. 6Method overloading means:
    1. ASame parameters, different method names
    2. Bprinting values
    3. CSame method name, different parameters
  7. 7What is the output of this code?

    static void Print(int a) {
    Console.WriteLine(a*A);
    }
    static void Print(double a) {
    Console.WriteLine(a+a);
    }
    static void Main(string[] args) {
    Print(3);
    }

    [blank_start]9[blank_end]
    1. A9
  8. 8To use data types, you need to define
    1. Amethods
    2. Ban int variable
    3. Ca class
  9. 9The process of creating objects is called:
    1. Aobjection
    2. Binstantiation
    3. Ccreation
    4. Dclassification
  10. 10Which of the following determines the current state of an object?
    1. Aproperties
    2. Bthe name of the object
    3. Cclasses

Information

Description
All of these questions are from SoloLearn. I am making these for myself to study them easier.
Language
English
Views
12
Tags
c#sololearn
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What should we add next?