Search Header Logo

MCQ2

Authored by Gadala Suhasini

Education

Professional Development

Used 4+ times

MCQ2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

class Program{

static void Main(string[] args) {

int result; int i;

for(i=-2;i<2;i++) {

result = i!=0?100/i:0;

Console.WriteLine("100/" + i + "is" + result);

Console.Read();

} } }

100/-2is-50

100/-1is-100

100/1is100

100/-2is-50

100/-1is100

100/1is100

It causes an exception

100/-2is-50

100/-1is-100

100/0is0

100/1is100

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The class Test1 inherits from class Test. An instance of Test1 is created and referenced in variable T1 using the following code: Test1 T1= new Test();

A variable called C1 of type Test is declared and T1 is a cast as type Test and assigned to C1 using the following code

Test C1 = (Test) T1

Which is the alternative syntax for the code above?

Test C1 = Test as Test1

Test C1 = T1 as Test1

Test(Test1) C1 = T1

Test C1 = (Test1 as Test) T1

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is statement is correct about constructor in C#.Net

A constructor cannot be declared as private

A constructor cannot be overloaded

A constructor can be static constructor

none of these

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when an exception object is not caught and handled properly?

The control goes to default exception handler

The compiler will not terminate the program

The compiler will terminate the program

None of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can an object of child type be assigned to variable of parent?

for example

card crd;

Birthday bd = new Birthday('Luci",42);

crd=bd;

No, there must be always be an exact match between the variable and object type

No, but a object of parent type can be assigned to variable of child

Yes an object can be assigned to a reference variable of parent

Yes, any object can be assigned to any reference variable

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the output of the following program

1,5

0,5

1,0

3,0

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

what is the output of the program

second method

20

second method

first method

second method

20

first method

second method

first method

20

second method

20

first method

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?