Static: Void String Int
Static: Void String Int
Static: Void String Int
a) Error codes
b) HERRESULT
c) On Error
d) Exceptions
2. 10. Predict the output for following set of code :
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
a) B B zero A A A
b) B zero A A A
c) B B B zero A A A
d) A A A zero B B B
3. 1. Select the output for following set of code :
1.
static void Main(string[] args)
2.
{
3.
int i, j;
4.
for (i = 1; i <= 3; i++)
5.
{
6.
j = 1;
7.
while (i % j == 2)
8.
{
9.
j++;
10.
}
11.
Console.WriteLine(i + " " + j);
12.
}
13.
Console.ReadLine();
14.
}
a) 11 21 31
b) 1 12 13 1
c) 11 21 31
d) 1 1 2 1 3 1
13.
14.
15.
16.
Console.WriteLine(i);
}
Console.ReadLine();
}
a) 1 2 3 4
12345
b) 1 2 3
1234
c) 1 2 3 4 5
1234
d) 1 2 3 4 5
12345
5. Select the output for following set of Code:
1.
static void Main(string[] args)
2.
{
3.
int x = 0;
4.
while (x < 20)
5.
{
6.
while (x < 10)
7.
{
8.
if (x % 2 == 0)
9.
{
10.
Console.WriteLine(x);
11.
}
12.
x++;
13.
}
14.
}
15.
Console.ReadLine();
16.
}
a) 1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
b) 0 2 4 6 8 10 12 14 16 18 20
c) 0 2 4 6 8
d) 0 2 4 6 8 10
6. Predict the output for following set of code :
1.
static void Main(string[] args)
2.
{
3.
int x;
4.
x = Convert.ToInt32(Console.ReadLine());
5.
int c = 1;
6.
while (c <= x)
7.
{
8.
if (c % 2 == 0)
9.
{
10.
Console.WriteLine("Execute While " + c + "\t" +
"time");
11.
}
12.
c++;
13.
}
14.
Console.ReadLine();
15.
}
16.
for x = 8.
a) Execute while 1 time
Execute while 3 time
Execute while 5 time
Execute while 7 time
b) Execute while 2 time
Execute while 4 time
Execute while 6 time
Execute while 8 time
c) Execute while 1 time
Execute while 2 time
Execute while 3 time
Execute while 4 time
8.
1, 3
B.
2, 4
C.
1, 2, 3
D.
4, 5
E.
None of these
9.
Which of the following statements are correct?
1. Data members ofa class are by default public.
2. Data members of a class are by default private.
3. Member functions of a class are by default public.
4. A private function of a class can access a public function within the
same class.
5. Member function of a class are by default private.
A.
1, 3, 5
B.
1, 4
C.
2, 4, 5
D.
1, 2, 3
E.
None of these
10.
Which of the following statements is correct about the C#.NET code
snippet given below?
namespace ConsoleApplication
{
class Sample
{
public int index;
public int[] arr = new int[10];
public void fun(int i, int val)
{
arr[i] = val;
}
}
class MyProgram
{
static void Main(string[] args)
{
Sample s = new Sample();
s.index = 20;
Sample.fun(1, 5);
s.fun(1, 5);
}
}
}
A.
B.
C.
D.
E.
11.
Which one of the following statements is correct?
A.
B.
C.
D.
E.
12. Which of the following statements is correct about the C#.NET code
snippet given below?
int i;
int j = new int();
i = 10;
j = 20;
String str;
str = i.ToString();
str = j.ToString();
A.
B.
C.
D.
E.
13.
Which of the following statements are correct about arrays used in
C#.NET?
1. Arrays can be rectangular or jagged.
2. Rectangular arrays have similar rows stored in adjacent memory
locations.
3. Jagged arrays do not have an access to the methods
of System.Array Class.
4. Rectangular arrays do not have an access to the methods
of System.ArrayClass.
5. Jagged arrays have dissimilar rows stored in non-adjacent memory
locations.
A.
1, 2
B.
1, 3, 5
C.
3, 4
D.
1, 2, 5
E.
4, 5
14.
What does the following C#.NET code snippet will print?
int i = 0, j = 0;
label:
i++;
j+=i;
if (i < 10)
{
Prints 1 to 9
B.
Prints 0 to 8
C.
Prints 2 to 8
D.
Prints 2 to 9
E.
15.
What will be the output of the C#.NET code snippet given below?
int val;
for (val = -5; val <= 5; val++)
{
switch (val)
{
case 0:
Console.Write ("India");
break;
}
if (val > 0)
Console.Write ("B");
else if (val < 0)
Console.Write ("X");
}
A.
XXXXXIndia
B.
IndiaBBBBB
C.
XXXXXIndiaBBBBB
D.
BBBBBIndiaXXXXX
E.
Zero
16.
The C#.NET code snippet given below generates ____ numbers series as
output?
int i = 1, j = 1, val;
while (i < 25)
{
Console.Write(j + " ");
val = i + j;
j = i;
i = val;
}
A.
Prime
B.
Fibonacci
C.
Palindrome
D.
Odd
E.
Even
17. Which of the class provides the operation of reading from and
writing to the console in C#.NET?
a) System.Array
b) System. Output
c) System.ReadLine
d) System.Console
18. Which of the given stream method provides the access to the output
console by default in C#.NET?
a) Console.In
b) Console.Out
c) Console.Error
d) All of the mentioned
19. What namespace does the Web page belong in the .NET Framework
class hierarchy?
a) System.Web.UI.Page
b)System.web.UI.Page.Controls.
c)System.Data.Configuration.
d)System.Data.Sqlclient.
20.The number of input methods defined by the stream method
Console.In in C#.NET is?
a) 4
b) 3
c) 2
d) 1
21.Select the correct methods provided by Console.In?
a) Read(), ReadLine()
b) ReadKey(), ReadLine()
c) Read(), ReadLine(), ReadKey()
d) ReadKey(), ReadLine()
22. Can you store multiple data types in System.Array?
a) Yes
b) No
23. Choose the output returned when error condition generates while
read() reads from the console.
a) False
b) 0
c) -1
d) All of the mentioned