Untitled Deck Flashcards

1
Q

What is the output of the following code?
```C#
try
{
int x = 20;
int y = x / 5;
Console.WriteLine(“Total: “ + y);
}
finally
{
Console.WriteLine(“ End! “);
}
~~~

A

Total: 4 End!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

This exception is thrown when an unacceptable argument is passed to a method.

A

ArgumentNullException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

This is used to get the size of the stream.

A

long length

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following statements is true about interface?

A

An interface can be implemented by multiple classes in the same program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Assuming the method implementations are correct, what will be displayed by the program below?
```C#
public delegate Val DelValues<Val>(Val arg);
private void btnShow_Click(object sender, EventArgs e)
{
DelValues<string> fullName = new DelValues<string>(Info.GetFullName);
DelValues<int> totalAmount = new DelValues<int>(Compute.GetTotalAmount);
Console.WriteLine(fullName("Paul Cruz"));
Console.WriteLine(totalAmount(230));
}
~~~</int></int></string></string></Val>

A

Paul Cruz 230

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What will be the output of the following program when compiled and executed?
```C#
using System;
public class Number
{
public Number(int number)
{
Console.WriteLine(number);
}
}
public class LocalNumber : Number
{
public LocalNumber(int num1, int num2) : base(num2)
{
Console.WriteLine(num1);
}
public static void Main(string[] args)
{
LocalNumber In1 = new LocalNumber(25, 50);
Console.ReadKey();
}
}
~~~

A

25 50

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which has a correct syntax of declaring a namespace?

A

namespace ExampleNamespace;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following types of stream refers to the objects where the data is written?

A

Output stream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following lines of code retrieves a value even if the current stream supports reading or not?

A

public abstract bool CanRead { get; }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following codes retrieves the value that the current stream supports reading?

A

public override bool CanRead { get; }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What property of a stream supports position request and returns true?

A

bool CanSeek

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following statements is true about the System.Data.Sql namespace?

A

It contains new generic interface and classes for SQL Server data access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the output of the following statements when executed?
```C#
StringBuilder word = new StringBuilder(“welcome”);
word[2] = ‘ ‘;
Console.Write(word);
~~~

A

we come

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

These primitive types directly store the value to the memory address.

A

Value types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

This syntax can be used to retrieve the value that will determine the current stream timeout.

A

public virtual bool CanTimeout { get; }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which of the following has an invalid conversion of data type?

A

int x = 3; short y = x;

17
Q

Which of the following syntax is correct in creating a custom exception?

A

class NumberFormatException : Exception { public NumberFormatException() { } }

18
Q

These special accessors are used to access private data fields of a class and still promote encapsulation.

A

Properties

19
Q

Which has a correct syntax of importing a namespace?

A

using ExampleNamespace;

20
Q

Which of the following syntaxes is used for stored procedure calls?

A

SqlCommand cmd = new SqlCommand(myQuery, sqlConnection);

21
Q

What is the output of the following program when compiled and executed?
```C#
using System;
public abstract class Number
{
public abstract void updateNumber(int n);
}
public class LocalNumber : Number
{
public void updateNumber(int n)
{
Console.WriteLine(n);
n = n++;
}
}
public static void Main(string[] args)
{
LocalNumber In1 = new LocalNumber();
In1.updateNumber(51);
}
~~~

A

51

22
Q

This code specifies the name of the file to be opened.

A

StreamWriter(string fileName)

23
Q

This statement is used to skip the remaining below statements of a loop and jumps back to evaluate the condition.

A

continue statement

24
Q

This keyword is used to call the exception manually.

A

throw

25
Q

Which of the following is a reference type?

A

string grade = “FAILED”

26
Q

This method is used to write the data into the file immediately.

A

Flush()

27
Q

It determines the location of the next read/write operation to take place on the file.

A

File pointer

28
Q

This statement includes logical expressions and selects one (1) from a multiple block of statements.

A

if-else-if statement

29
Q

Which of the following is preferred when a class needs only one (1) implementation of the method?

A

Interface

30
Q

Which of the following characterizes a local copy or related data tables?

A

DataSet