c# .net questions 1. Write a command that reads input from the command line and
ID: 3708685 • Letter: C
Question
c# .net questions
1.
Write a command that reads input from the command line and stores it as a int variable named
favorite_number.
2.
Assume you have a variable 'name'. Use String Interpolation to output "Hi" and the value assigned to the
name variable
3.
Rewrite the following if else block as a single line using the Conditional Operator ?
weather = ""
if ( temp > 32 )
weather = "Rain";
else
weather = "Snow";
4.
given an array of an unknown size, write a loop that will print all the values in the array
5.
Write a method header ( not the whole thing ) OrderCoffee that accepts a string for size, and Booleans for
cream and sugar. Default both cream and sugar to false.
pt 2
if false explain why
1. T/F - Forms applications differ from console based applications in that they are Event driven and must be built to
respond to events from the user.
2. T/F – Getting user input from a textbox can be done by using the Text property on the textbox object
3. T/F – When using Radio buttons, buttons that are near to each other will automatically group themselves so that only
one button can be selected at a time.
4. T/F – Each component must have it’s own unique event handler method.
5. T/F – A best practice is to decouple the UI components from the business logic
6. T/F – When writing unit tests, it’s best to have a single test method to hold all the logical tests
7. T/F – In an ideal world, unit tests would be extensive enough to ensure that when they are run, every line of code of
the class it is testing is ran.
8. T/F – If we achieve that ideal world from 7 above, we are guaranteed to have a bug free program
9. T/F – Any code that is worth writing is worth testing
10. Why does the code we write for Forms applications get put into a ‘partial’ class?
Explanation / Answer
As per Chegg guidelines, if a question of the user contains more than one question then the expert need to answer the first question. But I am answering the first four questions. Hope you read the guidelines and understand. :)
1. int number = Convert.ToInt32(Console.ReadLine());
2. Console.WriteLine("Hi" + name);
3.
weather = ""
temp > 32 ? weather = "Rain" : weather = "Snow";
4.
for(int i = 0; i < array.numbers; i++)
Console.WriteLine(array[i]);
**Comment for any further queries.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.