wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C# lesson10

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

Выберите строчку с правильно созданным массивом.

a)

int[] array = new int[return = ""];

b)

int[] array = new int[public bool];

c)

int[] array = new int[6];

d)

int array = new int;

2.

Выберите строчку с правильно созданным циклом.

a)

for(int; i = 0;i++){}

b)

for(i++){}

c)

for(int i = 0; i = 0;i++){}

d)

for(int i = 0; i < 10;i++){}

3.

Выберите строку где допущены ошибки.

a)

int a = 54;

float b = 23.4f;

string c = "str123";

b)

int a = 4;

float b = 4f;

string c = "4";

c)

int a = 5.5;

float b = 4f;

string c = 4;

d)

int a = 51;

float b = 4.6f;

string c = "";

4.

Как правильно создать метод?

a)

public void method(int a, int b){}

b)

public method(int a, int b){}

c)

public void method(a,b ){}

d)

method(int a, int b){}

5.

Выберите методы с возвращаемым значением.

a)

public int method(int a, int b)

b)

public void method(int a, int b)

c)

public float method(int a, int b)

d)

public string method(int a, int b)

e)

public void method(int a, int b)

6.

Что выведет программа на консоль ?

string str = "qwert";

Console.WriteLine(str[3]);

a)

q

b)

w

c)

e

d)

r

7.

Выберите строчку без ошибок .

a)

if (4 > ""){}

b)

if (4 = 4){}

c)

if (214 > 12 * 4){}

d)

if (4213){}

8.

Выберите как правильно создавать switch case .

a)

switch (bool)

{

case 1:

Console.WriteLine("Case 1");

break;

default:

Console.WriteLine("Default case");

break;

}

b)

int caseSwitch = 1;

switch (caseSwitch)

{

case 1:

Console.WriteLine("Case 1");

break;

default:

Console.WriteLine("Default case");

break;

}

c)

switch (case 1)

{

case 1:

Console.WriteLine("Case 1");

break;

}

d)

switch (caseSwitch)

{

}

9.

Выберите правильный ввод строки с консоли.

a)

string str = Console.ReadLine();

b)

string = Console.ReadLine();

c)

string str = Console.WriteLine();

d)

Console.ReadLine();

10.

Сколько раз выведется "Hello"?

for(int i = 0;i < 10; i= i+2)

{

Console.WriteLine("Hello");

}

a)

10

b)

3

c)

5

d)

15