Online C# Programming Test - C# Programming Test 9
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 constitutes the .NET Framework?
- ASP.NET Applications
- CLR
- Framework Class Library
- WinForm Applications
- Windows Services
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : .NET Framework
2.
Which of the following statements are correct about the C#.NET code snippet given below?
if (age > 18 && no < 11)
a = 25;
- The condition no < 11 will be evaluated only if age > 18 evaluates to True.
- The statement a = 25 will get executed if any one condition is True.
- The condition no < 11 will be evaluated only if age > 18 evaluates to False.
- The statement a = 25 will get executed if both the conditions are True.
- && is known as a short circuiting logical operator.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
3.
How many values is a function capable of returning?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions and Subroutines
4.
Which of the following will be the correct output for the C#.NET program given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[] args)
{
int a = 5;
int s = 0, c = 0;
Proc(a, ref s, ref c);
Console.WriteLine(s + " " + c);
}
static void Proc(int x, ref int ss, ref int cc)
{
ss = x * x;
cc = x * x * x;
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions and Subroutines
5.
Which of the following statements is correct about the C#.NET code snippet given below?
class Sample
{
private int i;
public Single j;
private void DisplayData()
{
Console.WriteLine(i + " " + j);
}
public void ShowData()
{
Console.WriteLine(i + " " + j);
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Classes and Objects
6.
What will be the size of the object created by the following C#.NET code snippet?
namespace IndiabixConsoleApplication
{
class Baseclass
{
private int i;
protected int j;
public int k;
}
class Derived: Baseclass
{
private int x;
protected int y;
public int z;
}
class MyProgram
{
static void Main (string[ ] args)
{
Derived d = new Derived();
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
7.
In an inheritance chain which of the following members of base class are accessible to the derived class members?
- static
- protected
- private
- shared
- public
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
8.
It is illegal to make objects of one class as members of another class.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
9.
Which of the following is the correct way to define a variable of the type struct Emp declared below?
struct Emp
{
private String name;
private int age;
private Single sal;
}
- Emp e(); e = new Emp();
- Emp e = new Emp;
- Emp e; e = new Emp;
- Emp e = new Emp();
- Emp e;
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
10.
The space required for structure variables is allocated on stack.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
11.
Which of the following CANNOT be a target for a custom attribute?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Attributes
12.
In which of the following collections is the Input/Output based on a key?
- Map
- Stack
- BitArray
- HashTable
- SortedList
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
13.
If a class Student has an indexer, then which of the following is the correct way to declare this indexer to make the C#.NET code snippet given below work successfully?
Student s = new Student();
s[1, 2] = 35;
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Properties
14.
Which of the following statements is correct about a namespace in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Namespaces
15.
Which of the following statements are correct about the exception reported below?
Unhandled Exception: System.lndexOutOfRangeException:
Index was outside the bounds of the array.
at IndiabixConsoleApplication.Program.Main(String[] args) in
D:\ConsoleApplication\Program.cs:line 14
Unhandled Exception: System.lndexOutOfRangeException:
Index was outside the bounds of the array.
at IndiabixConsoleApplication.Program.Main(String[] args) in
D:\ConsoleApplication\Program.cs:line 14
- The program did not handle an exception called IndexOutOfRangeException.
- The program execution continued after the exception occurred.
- The exception occurred in line number 14.
- In line number 14, the program attempted to access an array element which was beyond the bounds of the array.
- The CLR could not handle the exception.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Exception Handling
16.
It is compulsory for all classes whose objects can be thrown with throw statement to be derived from System.Exception class.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Exception Handling
17.
In order for an instance of a derived class to completely take over a class member from a base class, the base class has to declare that member as
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Polymorphism
18.
Which of the following statement is correct about the C#.NET code snippet given below?
public class Sample
{
public int x;
public virtual void fun()
{ }
}
public class DerivedSample : Sample
{
new public void fun()
{ }
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Polymorphism
19.
Which of the following statements is correct about an interface used in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Interfaces
20.
Which of the following statements are correct about an interface used in C#.NET?
- An interface can contain properties, methods and events.
- The keyword must implement forces implementation of an interface.
- Interfaces can be overloaded.
- Interfaces can be implemented by a class or a struct.
- Enhanced implementations of an interface can be developed without breaking existing code.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Interfaces
*** END OF THE TEST ***
Time Left: 00:29:56
Post your test result / feedback here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers