Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# VISUAL STUDIO MULTIPLE CHOICE QUESTIONS Question 1 Which beginning symbol(s)

ID: 3698082 • Letter: C

Question

C# VISUAL STUDIO

MULTIPLE CHOICE QUESTIONS

Question 1

Which beginning symbol(s) indicates the lines that follow will be comments?

Question 1 options:

**

//

/*

///

*/

Question 2

To mark the beginning of a block of code, C# programmers use:

Question 2 options:

()

begin end

start stop

{}

[]

Question 3

The character that cannot be used with an identifier is:

Question 3 options:

-

All of the above

*

$

#

Question 4

Which of the following is a valid declaration for a variable to store the name of a book?

Question 4 options:

string nameOfBook;

char name of book;

char book Name;

char bookName;

boolean nameOfBook;

Question 5

Given the call to the method ComputeCost() shown below, which of the following would be the most appropriate heading for the method? The variable someValue is declared as an int.

someValue = ComputeCost(27.3);

Question 5 options:

public int ComputeCost(int aValue)

public int ComputeCost()

public double ComputeCost(int someValue)

public int ComputeCost(double aValue)

public void ComputeCost(double aValue)

Question 6

The following is probably an example of a ____

DisplayInstructions();

Question 6 options:

method heading

call to a void method

call to a method with multiple arguments

method definition

call to a value-returning method

Question 7

Objects are instances of

Question 7 options:

methods

properties

classes

parameters

data members

Question 8

Which of the following would be a valid call to the default constructor for the following class?

public class Employee {

private string name;

public Employee() {

}

public Employee(string n) {

name = n;

}

}

Question 8 options:

Employee employee1;

Employee employee1 = new undergrad();

Employee employee1 = new Employee();

Employee employee1 = new Employee(default);

Not enough information is given to be able to answer.

Question 9

Given the following segment of code, what will be the output?

int x = 5;

if(x == 2)

Console.Write("Brown, brown, run aground. ");

else

Console.Write("Blue, blue, sail on through. ");

Console.Write("Green, green, nice and clean. ");

Question 9 options:

Blue, blue, sail on through. Green, green, nice and clean.

Brown, brown, run aground. Blue, blue sail on through.

Blue, blue, sail on through.

Brown, brown, run aground.

none of the above

Question 10

After execution of the following code, what will be the value of inputValue?

int inputValue = 0;

if(inputValue > 5)

inputValue += 5;

else if(inputValue > 2)

inputValue += 10;

else inputValue += 15;

Question 10 options:

10

15

25

0

5

Question 11

How many lines of output will be printed by the following program fragment?

for(int i = 0; i < 5; i += 2)

for(int j = 0; j < 4; j = j + 2)

    Console.WriteLine("{0} {1}", i, j);

Question 11 options:

6

20

None of the above

8

12

Question 12

Which of the following adds 42 to the element at the fifth physical spot?

int[] x = {12, 13, 14, 15, 16, 17, 18, 19};

Question 12 options:

x[5 + 42];

x[5] += 42;

none of the above

x = 42 + 5;

x[4] += 42;

Question 13

What is the effect of the following program segment?

int[] anArray = new int[50];

int i, j, temp;

string inValue;

for(i = 0; i < 50; i++)

{

Console.Write("Enter value");

inValue = Console.ReadLine();

anArray[i] = int.Parse(inValue);

}

temp = 0;

for(i = 1; i < 50; i++)

if(anArray[i] < anArray[0])

    temp++;

Question 13 options:

arranges the elements of array anArray in ascending order

none of the above

reverses the numbers stored in the array

puts the largest value in the last array position

counts the number of elements of array anArray less than its initial element

Question 14

Using the following declaration:

char[ , ] n = {'a', 'b', 'c', 'd', 'e'}, {'f', 'g', 'h', 'i', 'j'};

what does n[1, 1] refer to?

Question 14 options:

b

g

f

a

none of the above

Question 15

Which property is used with CheckBox and RadioButton objects to determine whether their option is selected?

Question 15 options:

SelectedItem

none of the above

Selected

Checked

SelectedIndex

Question 16

____ allows a method of a class to be called without regard to what specific implementation it provides.

Question 16 options:

Polymorphism

Abstraction

Class libraries

Assemblies

Versioning

Question 17

Classes can extend or derive from ______ class(es) and implement _______ interface(s).

Question 17 options:

many, one

many, many

one, many

one, two

one, one

Question 18

To avoid an IOException exception with files, you can either use a try...catch block or make sure there is a file before attempting to read characters from it. This can be done by:

Question 18 options:

throwing an exception

using a loop to cycle through the file structures

including statements in a finally block

calling the File.Exists() method

placing a test loop in the Main() metho

Note: Please State each question open answer you choose.

Explanation / Answer

C D B A D D C C A B B E E A E A C A