Arrays And Strings In C Sharp - Study Mode

[#76] What will be the output of the following C# code? static void Main(string[] args)
{
double a = 345.09

byte c = (byte) a

Console.WriteLine(c)

Console.ReadLine()

}
Correct Answer

(B) 89

[#77] What will be the output of the following C# code? class sum
{
public int x

private int y

public void math(int a, int b)
{
x = a * 4

y = b

}
}
class Program
{
static void Main(string[] args)
{
sum p = new sum()

p.math(12, 30)

Console.WriteLine(p.x + " " + p.y)

Console.ReadLine()

}
}
Correct Answer

(D) Compile time error

[#78] What will be the output of the following C# code? static void Main(string[] args)
{
String obj = "hello"

String obj1 = "worn"

String obj2 = obj

Console.WriteLine(obj + " " + (obj1.Replace('w' ,'c')))

Console.ReadLine()

}
Correct Answer

(C) hello corn

[#79] What is the correct way to declare and initialize a jagged array with 2 rows in C#?
Correct Answer

(A) int[][] jaggedArray = new int[2][]

[#80] What is the correct way to declare and initialize a multidimensional array with 3 rows and 4 columns in C#?
Correct Answer

(C) int[,] matrix = new int[3, 4]