gs gs108 Classes - Fundamentals of Class - Quiz No.2
gs gs108 CSharp Quiz
This quiz belongs to book/course code gs gs108 CSharp of gs organization. We have 110 quizzes available related to the book/course CSharp. This quiz has a total of 3 multiple choice questions (MCQs) to prepare and belongs to topic Classes. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 1: What will be the output of the following C# code?
class z { public string name1; public string address; public void show() { Console.WriteLine("{0} is in city{1}", name1, " ", address); } } class Program { static void Main(string[] args) { z n = new z(); n.name1 = "harsh"; n.address = "new delhi"; n.show(); Console.ReadLine(); } }
Syntax error
{0} is in city{1} harsh new delhi
harsh is in new delhi
Run successfully prints nothing
Question 2: What does the following C# code imply?
csharp abc; abc = new charp();
Object creation on class csharp
Create an object of type csharp on heap or on stack depending on the size of object
create a reference c on csharp and an object of type csharp on heap
create an object of type csharp on stack
Question 3: What will be the output of the following C# code?
class test { public void print() { Console.WriteLine("Csharp:"); } } class Program { static void Main(string[] args) { test t; t.print(); Console.ReadLine(); } }
Code runs successfully prints nothing
Code runs and prints “Csharp”
Syntax error as t is unassigned variable which is never used
None of the mentioned