Online C# Programming Test - C# Programming Test 6



Loading...  Loading Test...

Instruction:

  • This is a FREE online test. DO NOT pay money to anyone to attend this test.
  • Total number of questions : 20.
  • Time alloted : 30 minutes.
  • Each question carry 1 mark, no negative marks.
  • DO NOT refresh the page.
  • All the best :-).


1.

Which of the following statements is correct about the .NET Framework?

A.
.NET Framework uses DCOM for achieving language interoperability.
B.
.NET Framework is built on the DCOM technology.
C.
.NET Framework uses DCOM for making transition between managed and unmanaged code.
D.
.NET Framework uses DCOM for creating unmanaged applications.
E.
.NET Framework uses COM+ services while creating Distributed Applications.

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : .NET Framework

Discuss about this problem : Discuss in Forum


2.

Which of the following is an 8-byte Integer?

A.
Char
B.
Long
C.
Short
D.
Byte
E.
Integer

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Datatypes

Discuss about this problem : Discuss in Forum


3.

Which of the following statements is correct?

A.
Information is never lost during narrowing conversions.
B.
The CInteger() function can be used to convert a Single to an Integer.
C.
Widening conversions take place automatically.
D.
Assigning an Integer to an Object type is known as Unboxing.
E.
3.14 can be treated as Decimal by using it in the form 3.14F.

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Datatypes

Discuss about this problem : Discuss in Forum


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;
}

A.
The compiler will report case i and case j as errors since variables cannot be used in cases.
B.
Compiler will report an error since there is no default case in the switch case statement.
C.
The code snippet prints the result as "I am in Case i"".
D.
The code snippet prints the result as "I am in Case j".
E.
There is no error in the code snippet.

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Control Instructions

Discuss about this problem : Discuss in Forum


5.

Which of the following is NOT an Arithmetic operator in C#.NET?

A.
**
B.
+
C.
/
D.
%
E.
*

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Operators

Discuss about this problem : Discuss in Forum


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 + " ");
}

A.
8 4 16 12 20
B.
4 8 12 16 20
C.
4 8 16 32 64
D.
2 4 6 8 10

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Operators

Discuss about this problem : Discuss in Forum


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.

A.
1, 3, 5
B.
3, 4, 5
C.
2, 5
D.
4, 5
E.
None of these

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Functions and Subroutines

Discuss about this problem : Discuss in Forum


8.

Which of the following statements is correct?

A.
Procedural Programming paradigm is different than structured programming paradigm.
B.
Object Oriented Programming paradigm stresses on dividing the logic into smaller parts and writing procedures for each part.
C.
Classes and objects are corner stones of structured programming paradigm.
D.
Object Oriented Programming paradigm gives equal importance to data and the procedures that work on the data.
E.
C#.NET is a structured programming language.

Your Answer: Option (Not Answered)

Correct Answer: Option D

Learn more problems on : Classes and Objects

Discuss about this problem : Discuss in Forum


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(); 
        } 
    } 
}

A.
0 0.0
B.
36 5.4
C.
36 5.400000
D.
36 5
E.
None of the above

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Classes and Objects

Discuss about this problem : Discuss in Forum


10.

How many times can a constructor be called during lifetime of the object?

A.
As many times as we call it.
B.
Only once.
C.
Depends upon a Project Setting made in Visual Studio.NET.
D.
Any number of times before the object gets garbage collected.
E.
Any number of times before the object is deleted.

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Constructors

Discuss about this problem : Discuss in Forum


11.

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);
        } 
    } 
}

A.
The program gives the output as: Hi Hello Bye
B.
The program gives the output as: Bye Hello
C.
The program gives the output as: Hi Bye Hello
D.
Error in the program

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Inheritance

Discuss about this problem : Discuss in Forum


12.

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.

A.
1, 2, 4
B.
2, 4, 5
C.
1, 3, 5
D.
2, 4

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Inheritance

Discuss about this problem : Discuss in Forum


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.

A.
1, 2
B.
2, 3, 4
C.
2, 3, 5
D.
4, 5
E.
None of these

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Arrays

Discuss about this problem : Discuss in Forum


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);

A.
0
B.
1
C.
2
D.
-1
E.
-2

Your Answer: Option (Not Answered)

Correct Answer: Option D

Learn more problems on : Strings

Discuss about this problem : Discuss in Forum


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. */
    }
}

A.
delegate d(int i, Single j);
B.
delegate void d(int, Single);
C.
delegate int d(int i, Single j);
D.
delegate void (int i, Single j);
E.
delegate int sample.func(int i, Single j);

Your Answer: Option (Not Answered)

Correct Answer: Option C

Learn more problems on : Delegates

Discuss about this problem : Discuss in Forum


16.

Which of the following is correct ways of applying an attribute?

A.
[WebService (Name = "IndiaBIX", Description = "BIX WebService")] 
class AuthenticationService: WebService
{ /* .... */}
B.
<WebService ( Name : "IndiaBIX", Description : "BIX WebService" )> 
class AuthenticationService: inherits WebService
{ /* .... */}
C.
<WebService ( Name = "IndiaBIX", Description = "BIX WebService" )> 
class AuthenticationService: extends WebService
{ /* .... */}
D.
[WebService ( Name := "IndiaBIX", Description := "BIX WebService")] 
class AuthenticationService: inherits WebService
{ /* .... */}

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Attributes

Discuss about this problem : Discuss in Forum


17.

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

A.
arr.Count
B.
arr.GrowSize
C.
arr.MaxIndex
D.
arr.Capacity
E.
arr.UpperBound

Your Answer: Option (Not Answered)

Correct Answer: Option A

Learn more problems on : Collection Classes

Discuss about this problem : Discuss in Forum


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;

A.
1, 2
B.
2, 3
C.
3, 4
D.
3, 5

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Properties

Discuss about this problem : Discuss in Forum


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

A.
1, 3
B.
2, 4, 5
C.
3, 5
D.
1, 2, 3

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Namespaces

Discuss about this problem : Discuss in Forum


20.

Which of the following modifier is used when a virtual method is redefined by a derived class?

A.
overloads
B.
override
C.
overridable
D.
virtual
E.
base

Your Answer: Option (Not Answered)

Correct Answer: Option B

Learn more problems on : Polymorphism

Discuss about this problem : Discuss in Forum


Submit your test now to view the Results and Statistics with answer explanation.