IndiaBIX
IndiaBIX
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

Constructors- General Questions

  • Home
  • Computer Science & Engineering
  • C# Programming Questions and Answers
  • Constructors- General Questions
1. 

What will be the output of the C#.NET code snippet given below?

namespace IndiabixConsoleApplication
{
class Sample
{
public static void fun1()
{
Console.WriteLine("Bix1 method");
}
public void fun2()
{
fun1();
Console.WriteLine("Bix2 method");
}
public void fun2(int i)
{
Console.WriteLine(i);
fun2();
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Sample s = new Sample();
Sample.fun1();
s.fun2(123);
}
}
}

A. Bix1 method 123 Bixl method Bix2 method
B. Bix1 method 123 Bix2 method
C. Bix2 method 123 Bix2 method Bixl method
D. Bixl method 123
E. Bix2 method 123 Bixl method

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

2. 

Which of the following statements is correct about constructors in C#.NET?

A. A constructor cannot be declared as private.
B. A constructor cannot be overloaded.
C. A constructor can be a static constructor.
D. A constructor cannot access static data.
E. this reference is never passed to a constructor.

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

3. 

What will be the output of the C#.NET code snippet given below?

namespace IndiabixConsoleApplication
{
class Sample
{
static Sample()
{
Console.Write("Sample class ");
}
public static void Bix1()
{
Console.Write("Bix1 method ");
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Sample.Bix1();
}
}
}

A. Sample class Bix1 method
B. Bix1 method
C. Sample class
D. Bix1 method Sample class
E. Sample class Sample class

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

4. 

Which of the following statements are correct about static functions?

A. Static functions are invoked using objects of a class.
B. Static functions can access static data as well as instance data.
C. Static functions are outside the class scope.
D. Static functions are invoked using class.

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

5. 

Is it possible for you to prevent an object from being created by using zero argument constructor?

A. Yes
B. No

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

6. 

Which of the following statements is  correct?

 

A. There is one garbage collector per program running in memory.
B. There is one common garbage collector for all programs.
C. An object is destroyed by the garbage collector when only one reference refers to it.
D. We have to specifically run the garbage collector after executing Visual Studio.NET.

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

7. 

Which of the following statements are correct about the C#.NET code snippet given below?

class Sample
{
static int i;
int j;
public void proc1()
{
i = 11;
j = 22;
}
public static void proc2()
{
i = 1;
j = 2;
}
static Sample()
{
i = 0;
j = 0;
}
}

A. i cannot be initialized in proc1().
B. proc1() can initialize i as well as j.
C. j can be initialized in proc2().
D. The constructor can never be declared as static.
E. proc2() can initialize i as well as j.

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

8. 

Is it possible to invoke Garbage Collector explicitly?

A. Yes
B. No

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

  • 1
  • 2
  • 3

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2023

Admit Card

Admit Card 2023

Answer Key

Answer Key 2023
copyright
Privacy Policy
© 2025 IndiaBIX. All Rights Reserved.

Report