Đề thi trắc nghiệm môn C sharp (7) - Pdf 29

Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

61

A.
True
B.
False

24. Private members of base class cannot be accessed by derived class member functions or
objects of derived class.
A.
True
B.
False

25. A class D can be derived from a class C, which is derived from a class B, which is derived
from a class A.
A.
True
B.
False

26. There is no multiple inheritance in C#.NET. That is, a class cannot be derived from
multiple base classes.
A.
True
B.
False

27. Creating a derived class from a base class requires fundamental changes to the base

}
static void funcr (ref int num)
{
num = num + 10; Console.Write(num + ", ");
}
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

62

}
}
A.
1, 1, 1, 1,
B.
11, 1, 11, 11,
C.
11, 11, 11, 11,
D.
11, 11, 21, 11,
E.
11, 11, 21, 21,

2. What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[] args)
{
int[]arr = newint[]{ 1, 2, 3, 4, 5 };


63

5. To use a ref parameter only the calling method must explicitly use the refkeyword.
A.
1, 2
B.
2, 3
C.
3, 4
D.
4, 5
E.
None of these 4. A function returns a value, whereas a subroutine cannot return a value.
A.
True
B.
False
5. Which of the following statements are correct about functions and subroutines used in
C#.NET?
1. A function cannot be called from a subroutine.
2. The ref keyword causes arguments to be passed by reference.
3. While using ref keyword any changes made to the parameter in the method will be reflected in
that variable when control passes back to the calling method.

{
ss = x * x;
cc = x * x * x;
}
}
}
A.
0 0
B.
25 25
C.
125 125
D.
25 125
E.
None of the above 7. What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
int i = 10;
double d = 34.340;
fun(i);
fun(d);
}

2, 5
D.
4, 5
E.
None of these
9. If a procedure fun() is to receive an int, a Single & a double and it is to return a
decimal then which of the following is the correct way of defining this procedure?
A.
fun(int i, Single j, double k) decimal
{ }
B.
static decimal fun(int i, Single j, double k)
{ }
C.
fun(int i, Single j, double k)
{

return decimal;
}
D.
static decimal fun(int i, Single j, double k) decimal
{ }
E.
A procedure can never return a value.

2. Functions can be called recursively.
3. If we do not return a value from a function then a value -1 gets returned.
4. To return the control from middle of a function exit function should be used.
5. Function calls can be nested.
A.
1, 2, 5
B.
2, 3, 5
C.
2, 3
D.
4, 5
E.
None of these

12. How many values is a function capable of returning?
A.
1
B.
0
C.
Depends upon how many params arguments does it use.
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

67

D.
Any number of values.
E.
Depends upon how many ref arguments does it use.

B.
Any number of values.
C.
Depends upon how many ref arguments does it use.
D.
0
E.
1 15. Which of the following CANNOT occur multiple number of times in a program?
A.
namespace
B.
Entrypoint
C.
Class
D.
Function
E.
Subroutine
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

68

16. What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication

5040
17. If a function fun() is to sometimes receive an int and sometimes a double then which
of the following is the correct way of defining this function?
A.
static void fun(object i)
{ }
B.
static void fun(int i)
{ }
C.
static void fun(double i, int j)
{ }
D.
static void fun(int i, double j)
{ }
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

69

E.
static void fun(int i, double j, )
{ }

18. Which of the following statements are correct about subroutines used in C#.NET?
1. If we do not return a value from a subroutine then a value -1 gets returned.
2. Subroutine definitions cannot be nested.
3. Subroutine can be called recursively.

Console.WriteLine(s +" " + c) ;
}
static int fun(int x)
{
int ss, cc;
ss = x * x; cc = x * x * x;
return ss, cc;
}
}
}
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

70

1. An error will be reported in the statement s, c = fun(a); since multiple values returned
from a function cannot be collected in this manner.
2. It will output 25 125.
3. It will output 25 0.
4. It will output 0 125.
5. An error will be reported in the statement return ss, cc; since a function cannot return
multiple values.
A.
1, 3
B.
2, 4
C.
4, 5
D.
1, 5
E.

C.
25, 36


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status