Online C# Programming Test - C# Programming Test - Random
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 are NOT true about .NET Framework?
- It provides a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely.
- It provides a code-execution environment that minimizes software deployment and versioning conflicts.
- It provides a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party.
- It provides different programming models for Windows-based applications and Web-based applications.
- It provides an event driven programming model for building Windows Device Drivers.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : .NET Framework
2.
What will be the output of the following code snippet when it is executed?
int x = 1;
float y = 1.1f;
short z = 1;
Console.WriteLine((float) x + y * z - (x += (short) y));Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
3.
Which of the following statement correctly assigns a value 33 to a variable c?
byte a = 11, b = 22, c;Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
4.
Which of the following is the correct ways to set a value 3.14 in a variable pi such that it cannot be modified?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
5.
Which of the following statements is correct about the C#.NET code snippet given below?
short s1 = 20;
short s2 = 400;
int a;
a = s1 * s2;Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
6.
Which of the following loop correctly prints the elements of the array?
char[ ] arr = new char[ ] {'k', 'i','C', 'i','t'} ;Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
7.
Which of the following is NOT an Arithmetic operator in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
8.
Which of the following statements is correct about the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
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);
}
}
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Classes and Objects
9.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
string str= "Hello World!";
Console.WriteLine( String.Compare(str, "Hello World?" ).GetType() );
}
}
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Strings
10.
Which of the following are true about classes and struct?
- A class is a reference type, whereas a struct is a value type.
- Objects are created using new, whereas structure variables can be created either using new or without using new.
- A structure variable will always be created slower than an object.
- A structure variable will die when it goes out of scope.
- An object will die when it goes out of scope.
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 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
12.
Which of the following is the correct way to call subroutine MyFun() of the Sample class given below?
class Sample
{
public void MyFun(int i, Single j)
{
Console.WriteLine("Welcome to IndiaBIX !");
}
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Delegates
13.
Which of the following statements is correct about the C#.NET code snippet given below?
int a = 10;
int b = 20;
int c = 30;
enum color: byte
{
red = a,
green = b,
blue = c
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
14.
In a HashTable Key cannot be null, but Value can be.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
15.
Which of the following statements are correct about a namespace used in C#.NET?
- Classes must belong to a namespace, whereas structures need not.
- Every class, struct, enum, delegate and interlace has to belong to some or the other namespace.
- All elements of the namespace have to belong to one file.
- If not mentioned, a namespace takes the name of the current project.
- The namespace should be imported to be able to use the elements in it.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Namespaces
16.
Which of the following is NOT a namespace in the .NET Framework Class Library?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Namespaces
17.
Which of the following C#.NET code snippets will correctly print "Hello C#.NET"?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Namespaces
18.
Which of the following is NOT an Exception?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Exception Handling
19.
In C#.NET if we do not catch the exception thrown at runtime then which of the following will catch it?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Exception Handling
20.
A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?
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