Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C# QUESTIONS : PART 4

Which statement is correct about following c#.NET code ?
int[] a= {11, 3, 5, 9, 6};

‘a’ is a reference to the array created on stack

 ‘a’ is a reference to an object created on stack

‘a’ is a reference to an object of a class that compiler drives from ‘System.Array’ class

None of the mentioned

SHOW ANSWER

What is the advantage of using 2D jagged array over 2D rectangular array?

Easy initialization of elements

Allows unlimited elements as well as rows which had ‘0’ or are empty in nature

All of the mentioned

None of the mentioned

SHOW ANSWER

Which statement is correct about following set of code ?
int[, ]a={{5, 4, 3},{9, 2, 6}};

’a’ represents 1-D array of 5 integers

a.GetUpperBound(0) gives 9

’a’ represents rectangular array of 2 columns and 3 arrays 

a.GetUpperBound(0) gives 2

SHOW ANSWER

Choose selective differences between an array in c# and array in other programming languages.

Declaring array in C# the square bracket([]) comes after the type but not after identifier 

It is necessary to declare size of an array with its type

 No difference between declaration of array in c# as well as as in other programming languages

 All of the mentioned

SHOW ANSWER

Which one of the following classes are present System.Collections.Generic namespace?

 

  1. Stack
  2. Tree
  3. SortedDictionary
  4. SortedArray

1 and 2 only

2 and 4 only

1 and 3 only 

All of the above

None of the above

SHOW ANSWER

Which of the following statements are valid about generics in .NET Framework?

  1. Generics is a language feature.
  2. We can create a generic class, however, we cannot create a generic interface in C#.NET.
  3. Generics delegates are not allowed in C#.NET.
  4. Generics are useful in collection classes in .NET framework.

None of the above

1 and 2 Only

1, 2 and 3 Only

1 and 4 Only  

All of the above

None of the above

SHOW ANSWER

Which among the given classes is present in System.Collection.Generic.namespace?

Stack 

Tree

Sorted Array

All of the mentioned

SHOW ANSWER

What will be the output of the given code snippet?

  1. public class Generic<T>
  2. {
  3.     Stack<T> stk = new Stack<T>();
  4.     public void push(T obj)
  5.     {
  6.         stk.Push(obj);
  7.     }
  8.     public T pop()
  9.     {
  10.         T obj = stk.Pop();
  11.         return obj;
  12.     }
  13. }
  14. class Program
  15. {
  16.     static void Main(string[] args)
  17.     {
  18.         Generic<string> g = new Generic<string>();
  19.         g.push(40);
  20.         Console.WriteLine(g.pop());
  21.         Console.ReadLine();
  22.     }
  23. }

0

Runtime Error

 40 

Compile time Error

SHOW ANSWER

Which among the following is the correct way to find out the number of elements currently present in an ArrayListCollection called arr?

arr.Capacity

 arr.Count

arr.MaxIndex

arr.UpperBound

SHOW ANSWER

Which statement is correct about the C#.NET code snippet given below?

  1. Stack st = new Stack();
  2. st.Push("Csharp");
  3. st.Push(7.3);
  4. st.Push(8);
  5. st.Push('b');
  6. st.Push(true);

Unsimilar elements like “Csharp”,7.3,8 cannot be stored in the same stack collection.

Boolean values can never be stored in Stack collection

Perfectly workable code

All of the mentioned

SHOW ANSWER

Among the given collections which one is I/O index based?

ArrayList 

List

Stack

Queue

SHOW ANSWER

What is the output of the following set of code?

  1.  static void Main(string[] args)
  2.  {
  3.      int a = 5;
  4.      int s = 0, c = 0;
  5.      Mul (a, ref s, ref c);
  6.      Console.WriteLine(s + "t " +c);
  7.      Console.ReadLine();
  8.  }
  9.  static void Mul (int x, ref int ss, ref int cc)
  10.  {
  11.      ss = x * x;
  12.      cc = x * x * x;
  13.  }

125 25

 25 125

Compile time error

0 0

SHOW ANSWER

Number of constructors a class can define is ?


 

1

2

Any number 

None of the mentioned

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in