Online C# Programming Test - C# Programming Test 6

Instruction:

  • This is a FREE online test. Beware of scammers who ask for money to attend this test.
  • Total number of questions: 20.
  • Time allotted: 30 minutes.
  • Each question carries 1 mark; there are no negative marks.
  • DO NOT refresh the page.
  • All the best!

Marks : 2/20


Total number of questions
20
Number of answered questions
0
Number of unanswered questions
20
Test Review : View answers and explanation for this test.

1.
Which of the following statements is correct about the .NET Framework?
.NET Framework uses DCOM for achieving language interoperability.
.NET Framework is built on the DCOM technology.
.NET Framework uses DCOM for making transition between managed and unmanaged code.
.NET Framework uses DCOM for creating unmanaged applications.
.NET Framework uses COM+ services while creating Distributed Applications.
Your Answer: Option
(Not Answered)
Correct Answer: Option

2.
Which of the following statements is correct?
Information is never lost during narrowing conversions.
The CInteger() function can be used to convert a Single to an Integer.
Widening conversions take place automatically.
Assigning an Integer to an Object type is known as Unboxing.
3.14 can be treated as Decimal by using it in the form 3.14F.
Your Answer: Option
(Not Answered)
Correct Answer: Option

3.
Which of the following is an 8-byte Integer?
Char
Long
Short
Byte
Integer
Your Answer: Option
(Not Answered)
Correct Answer: Option

4.
Which of the following statements is correct about the C#.NET code snippet given below?
int i, j, id = 0; switch (id)
{ 
    case i:
        Console.WriteLine("I am in Case i");
        break; 
    
    case j:
        Console.WriteLine("I am in Case j");
        break;
}
The compiler will report case i and case j as errors since variables cannot be used in cases.
Compiler will report an error since there is no default case in the switch case statement.
The code snippet prints the result as "I am in Case i"".
The code snippet prints the result as "I am in Case j".
There is no error in the code snippet.
Your Answer: Option
(Not Answered)
Correct Answer: Option

5.
Which of the following is NOT an Arithmetic operator in C#.NET?
**
+
/
%
*
Your Answer: Option
(Not Answered)
Correct Answer: Option

6.
What will be the output of the C#.NET code snippet given below?
int i, j = 1, k;
for (i = 0; i < 5; i++)
{
    k = j++ + ++j;
    Console.Write(k + " ");
}
8 4 16 12 20
4 8 12 16 20
4 8 16 32 64
2 4 6 8 10
Your Answer: Option
(Not Answered)
Correct Answer: Option

7.
Which of the following statements are correct?
  1. C# allows a function to have arguments with default values.
  2. C# allows a function to have variable number of arguments.
  3. Omitting the return value type in method definition results into an exception.
  4. Redefining a method parameter in the method's body causes an exception.
  5. params is used to specify the syntax for a function with variable number of arguments.
1, 3, 5
3, 4, 5
2, 5
4, 5
None of these
Your Answer: Option
(Not Answered)
Correct Answer: Option

8.
Which of the following statements is correct?
Procedural Programming paradigm is different than structured programming paradigm.
Object Oriented Programming paradigm stresses on dividing the logic into smaller parts and writing procedures for each part.
Classes and objects are corner stones of structured programming paradigm.
Object Oriented Programming paradigm gives equal importance to data and the procedures that work on the data.
C#.NET is a structured programming language.
Your Answer: Option
(Not Answered)
Correct Answer: Option

9.
Which of the following will be the correct output for the C#.NET program given below?
namespace IndiabixConsoleApplication
{ 
    class Sample
    { 
        int i; 
        Single j; 
        public void SetData(int i, Single j)
        { 
            this.i = i; 
            this.j = j;
        }
        public void Display()
        { 
            Console.WriteLine(i + " " + j);
        } 
    } 
    class MyProgram
    { 
        static void Main(string[ ] args)
        {
            Sample s1 = new Sample(); 
            s1.SetData(36, 5.4f); 
            s1.Display(); 
        } 
    } 
}
0 0.0
36 5.4
36 5.400000
36 5
None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option

10.
How many times can a constructor be called during lifetime of the object?
As many times as we call it.
Only once.
Depends upon a Project Setting made in Visual Studio.NET.
Any number of times before the object gets garbage collected.
Any number of times before the object is deleted.
Your Answer: Option
(Not Answered)
Correct Answer: Option

11.
Which of the following statements are correct about Inheritance in C#.NET?
  1. A derived class object contains all the base class data.
  2. Inheritance cannot suppress the base class functionality.
  3. A derived class may not be able to access all the base class data.
  4. Inheritance cannot extend the base class functionality.
  5. In inheritance chain construction of object happens from base towards derived.
1, 2, 4
2, 4, 5
1, 3, 5
2, 4
Your Answer: Option
(Not Answered)
Correct Answer: Option

12.
Which of the following is correct about the C#.NET snippet given below?
namespace IndiabixConsoleApplication
{ 
    class Baseclass
    { 
        public void fun()
        { 
            Console.WriteLine("Hi" + " ");
        } 
        public void fun(int i)
        {
            Console.Write("Hello" + " ");
        } 
    } 
    class Derived: Baseclass
    {
        public void fun()
        {
            Console.Write("Bye" + " ");
        } 
    } 
    class MyProgram
    { 
        static void Main(string[ ] args)
        { 
            Derived d; 
            d = new Derived(); 
            d.fun(); 
            d.fun(77);
        } 
    } 
}
The program gives the output as: Hi Hello Bye
The program gives the output as: Bye Hello
The program gives the output as: Hi Bye Hello
Error in the program
Your Answer: Option
(Not Answered)
Correct Answer: Option

13.
Which of the following statements are correct about the C#.NET code snippet given below?
    int[] a = {11, 3, 5, 9, 4}; 
  1. The array elements are created on the stack.
  2. Refernce a is created on the stack.
  3. The array elements are created on the heap.
  4. On declaring the array a new array class is created which is derived from System.Array Class.
  5. Whether the array elements are stored in the stack or heap depends upon the size of the array.
1, 2
2, 3, 4
2, 3, 5
4, 5
None of these
Your Answer: Option
(Not Answered)
Correct Answer: Option

14.
Which of the following will be the correct output for the C#.NET code snippet given below?
String s1 = "Five Star";
String s2 = "FIVE STAR";
int c;
c = s1.CompareTo(s2);
Console.WriteLine(c);
0
1
2
-1
-2
Your Answer: Option
(Not Answered)
Correct Answer: Option

15.
Which of the following are the correct ways to declare a delegate for calling the function func() defined in the sample class given below?
class Sample
{
    public int func(int i, Single j)
    {
        /* Add code here. */
    }
}
delegate d(int i, Single j);
delegate void d(int, Single);
delegate int d(int i, Single j);
delegate void (int i, Single j);
delegate int sample.func(int i, Single j);
Your Answer: Option
(Not Answered)
Correct Answer: Option

16.
Which of the following is correct ways of applying an attribute?
[WebService (Name = "IndiaBIX", Description = "BIX WebService")] 
class AuthenticationService: WebService
{ /* .... */}
<WebService ( Name : "IndiaBIX", Description : "BIX WebService" )> 
class AuthenticationService: inherits WebService
{ /* .... */}
<WebService ( Name = "IndiaBIX", Description = "BIX WebService" )> 
class AuthenticationService: extends WebService
{ /* .... */}
[WebService ( Name := "IndiaBIX", Description := "BIX WebService")] 
class AuthenticationService: inherits WebService
{ /* .... */}
Your Answer: Option
(Not Answered)
Correct Answer: Option

17.
Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr?
arr.Count
arr.GrowSize
arr.MaxIndex
arr.Capacity
arr.UpperBound
Your Answer: Option
(Not Answered)
Correct Answer: Option

18.
If a Student class has an indexed property which is used to store or retrieve values to/from an array of 5 integers, then which of the following are the correct ways to use this indexed property?
  1. Student[3] = 34;
  2. Student s = new Student(); 
    s[3] = 34;
  3. Student s = new Student(); 
    Console.WriteLine(s[3]);
  4. Console.WriteLine(Student[3]);
  5. Student.this s = new Student.this(); 
    s[3] = 34;
1, 2
2, 3
3, 4
3, 5
Your Answer: Option
(Not Answered)
Correct Answer: Option

19.
Which of the followings are NOT a .NET namespace?
  1. System.Web
  2. System.Process
  3. System.Data
  4. System.Drawing2D
  5. System.Drawing3D
1, 3
2, 4, 5
3, 5
1, 2, 3
Your Answer: Option
(Not Answered)
Correct Answer: Option

20.
Which of the following modifier is used when a virtual method is redefined by a derived class?
overloads
override
overridable
virtual
base
Your Answer: Option
(Not Answered)
Correct Answer: Option

*** END OF THE TEST ***
Time Left: 00:29:56
Post your test result / feedback here: