javascript
Brief description  about Online courses   join in Online courses
View  's Profile

Check Your Knowledge c# 1

1. Which of the following is a class?
a. System
b. Console
c. public
d. WriteLine()

2. If a programmer inserts using System; at the top of a C# program, which of the following can the programmer use as an alternative to System.Console.WriteLine("Hello");?

a. System("Hello");
b. WriteLine("Hello");
c. Console.WriteLine("Hello");
d. Console("Hello");


3. Assume you have declared a variable as double hourly =
13.00;. What will the statement Console.WriteLine(hourly);
display?
a. 13
b. 13.0
c. 13.00
d. 13.000000


4. Assume you have declared a variable as double salary
= 45000.00;. Which of the following will display $45,000?

a. Console.WriteLine(salary.ToString("c"));
b. Console.WriteLine(salary.ToString("c0"));
c. Console.WriteLine(salary);
d. two of these

5. The value in a TextBox is

a. an int
b. a double
c. a string
d. It might be any of the above.

6. The process of changing a program’s internal structure
without changing the way the program works is
a. compiling
b. debugging
c. code refactoring
d. systems analysis


7.If you inadvertently create a Click() method for a control that should not generate a click event, you can successfully eliminate the method by

a. deleting the method code from the Form1.cs file
b. eliminating the method from the event list in the Properties window
c. adding the method to the Discard window
d. making the method a comment by placing two forward
slashes at the start of each line


That's all for now, more will be displayed soon. Have fun.

Hope these questions will be useful.


Asked by | Jun 15, 2012 |  Reply now
Replies (1)
View  's Profile
Answers: 1. Console is a class, System is namespace, writeline is a method.

2. Answer is C. We can use only namespaces in using system; etc.
for example It is illegal to use a way like using system.console;

3. Answer is 13. C# compiler will automatically convert it.

4.Answer is option a in my opinion, i am preety much sure about it.

5. Option C and D, By default it is string , we need to convert it to integer using converttoint32 or double method.

So a text box can contain all of above.

6. Option C, code refactoring.

7. Option b, we must eliminate method from event list in properties window otherwise compiler error will occur.

If I am wrong in my answers, please notify me.

Kanhiya Deswal



Jun 17, 2012