Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1: Which of the following will be the correct output for the C#.NET code snippet given below? string s1 = ALL MEN; string s2

Question 1:

Which of the following will be the correct output for the C#.NET code snippet given below?

string s1 = "ALL MEN"; string s2 = " ARE CREATED EQUAL"; string s3 = s1 + s2; Console.WriteLine(s3);

1.

s3

2.

ARE CREATED EQUAL

3.

ALL MEN ARE CREATED EQUAL

4.

Error message

5.

ALL MEN

Question 2:

Which of the following are value types?

  • Integer

  • Array

  • Object

  • String

  • Long

a.

1, 2, 5

b.

1, 5

c.

all of them

d.

2, 4

e.

3, 5

Question 3:

A C# class will no longer have an implicit default constructor if an overloaded constructor has been added.

True

False

Question 5:

Given the following declarations, what is stored in ans as a result of the arithmetic expression?

int ans = 1, v1 = 2, v2 = 8

ans+= v2 / v1++

A.

2

B.

4

C.

5

D.

3

Question 6:

Select all that apply. Identify syntax error(s) in the following code snippet:

using System //Line 1

namespace TestAnalysis //Line 2

{ //Line 3

Exam1 //Line 4

{ //Line 5

static main() //Line 6

{ //Line 7

console.write("Can I be wrong?") //Line 8

} // Line 9

} //Line 10

a

Missing semicolon in Line 8

b

Missing System keyword before console.write in Line 8

c

Missing semicolon after main() in Line 6

d

Missing semicolon in Line 1

e

Missing closing curly brace after Line 8

f

Missing 'class' keyword in Line 4

g

Case capitalization error for main method in Line 6

h

Case capitalization error for console and write keywords in Line 8

Question 7:

Which of the following statements are correct about the C# program given below?

namespace ConsoleApplication

{

class SampleProgram

{

static void Main(string[ ] args)

{

int a = 5;

int s = 0, c = 0;

s, c = fun(a);

Console.WriteLine(s +" " + c) ;

}

static int fun(int x)

{

int ss, cc;

ss = x * x; cc = x * x * x;

return ss, cc;

}

}

}

1.

An error will be reported in the statement s, c = fun(a); since multiple values returned from a function cannot be collected in this manner.

2.

It will output 25 125.

3.

An error will be reported in the statement return ss, cc; since a function cannot return multiple values.

4.

It will output 0 125

Question 8:

What should the name and type of the property be for the following member variable:

private string firstName;

string FirstName

string Name

string firstName

char FirstName

It doesn't matter the name as long as the type is string.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions