Online C# Programming Test - C# Programming Test 2
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 Managed Code?
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 is the root of the .NET type hierarchy?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : .NET Framework
3.
Which of the following code snippets are the correct way to determine whether a is Odd or Even?
int a; String res; if (a % 2 == 0) res = "Even"; else res = "Odd";
int a; String res; if (a Mod 2 == 0) res = "Even"; else res = "Odd";
int a; Console.WriteLine(a Mod 2 == 0 ? "Even": "Odd");
int a; String res; a % 2 == 0 ? res = "Even" : res = "Odd"; Console.WriteLine(res);
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
4.
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 get evaluated only if age > 18 evaluates to False.
- The condition no < 11 will get evaluated if age > 18 evaluates to True.
- The statement a = 25 will get evaluated if any one one of the two conditions is True.
- || is known as a short circuiting logical operator.
- The statement a = 25 will get evaluated only if both the conditions are True.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
5.
Which of the following statements is correct about Bitwise ^ operator used in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
6.
Suppose n is a variable of the type Byte and we wish to put OFF its fourth bit (from right) without disturbing any other bits. Which of the following statements will do this correctly?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
7.
What will be the output of the C#.NET code snippet given below?
byte b1 = 0xAB;
byte b2 = 0x99;
byte temp;
temp = (byte)~b2;
Console.Write(temp + " ");
temp = (byte)(b1 << b2);
Console.Write (temp + " ");
temp = (byte) (b2 >> 2);
Console.WriteLine(temp);
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?
class Student s1, s2; // Here 'Student' is a user-defined class.
s1 = new Student();
s2 = new Student();
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Classes and Objects
9.
Which of the following statements are correct about objects of a user-defined class called Sample?
- All objects of Sample class will always have exactly same data.
- Objects of Sample class may have same or different data.
- Whether objects of Sample class will have same or different data depends upon a Project Setting made in Visual Studio.NET.
- Conceptually, each object of Sample class will have instance data and instance member functions of the Sample class.
- All objects of Sample class will share one copy of member functions.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Classes and Objects
10.
Which of the following statements are correct about the this reference?
- this reference can be modified in the instance member function of a class.
- Static functions of a class never receive the this reference.
- Instance member functions of a class always receive a this reference.
- this reference continues to exist even after control returns from an instance member function.
- While calling an instance member function we are not required to pass the this reference explicitly.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Classes and Objects
11.
Which of the following statements is correct about the C#.NET code snippet given below?
struct Book
{
private String name;
private int noofpages;
private Single price;
}
Book b = new Book();
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 statements are correct about Structures used in C#.NET?
- A Structure can be declared within a procedure.
- Structs can implement an interface but they cannot inherit from another struct.
- struct members cannot be declared as protected.
- A Structure can be empty.
- It is an error to initialize an instance field in a struct.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
13.
How many bytes will the structure variable samp occupy in memory if it is defined as shown below?
class Trial
{
int i;
Decimal d;
}
struct Sample
{
private int x;
private Single y;
private Trial z;
}
Sample samp = new Sample();
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
14.
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
15.
Which of the following is the correct way to access all elements of the Stack collection created using the C#.NET code snippet given below?
Stack st = new Stack();
st.Push(11);
st.Push(22);
st.Push(-53);
st.Push(33);
st.Push(66);
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
16.
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
17.
Which of the following can be declared as a virtual in a class?
- Methods
- Properties
- Events
- Fields
- Static fields
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 is the correct implementation of the interface given below?
interface IMyInterface
{
double MyFun(Single i);
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Interfaces
19.
Which of the following statements is correct about the C#.NET code snippet given below?
interface IMyInterface
{
void fun1();
void fun2();
}
class MyClass: IMyInterface
{
private int i;
void IMyInterface.fun1()
{
// Some code
}
}
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 is correct about the C#.NET code snippet given below?
interface IPerson
{
String FirstName
{
get;
set;
}
String LastName
{
get;
set;
}
void Print();
void Stock();
int Fun();
}
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