Details of this Paper

devry cis170 all ilabs and all quizes

Description

solution


Question

Question;PrintiLab 1 of 7: Getting Started (Your First C# Programs) - (45 points)Note!Submit your assignment to the Dropbox located on the silver tab at the top of this page.(See the Syllabus section "Due Dates for Assignments & Exams" for due dates.)Remember This!Connect to the iLab here.iLAB OVERVIEWScenario and SummaryWelcome to Programming with C#. The purpose of this three-part lab is to walk you through the following tutorial to become familiar with the actions of compiling and executing a C# program.DeliverablesnI entered a number and pressed the button.After entering several numbers, I got the following:The following message is displayed when the guess is right.TipsPseudocode:Form constructor methodRandomly pick a target number between 0 and 100Evaluate Button Click Event Handler MethodIf the guess text box is not blank Pull the guess from the text boxAdd 1 to the number of guesses If the guess is less than the target Make the Evaluate button invisibleChange the label message to "Too Low!!"Make the label message visibleChange the background color of the form to LightSeaGreenMake the Try Again button visibleElse if the guess is greater than the target Make the Evaluate button invisibleChange the label message to "Too High!!"Make the label message visibleChange the background color of the form to SlateBlueMake the Try Again button visibleElse Display a message indicating the user guessed correctly and display the number of guesses it took.End-IfEnd-IfTry Again Button Click Event handlerClear the guess text boxMake the label message and Try Again buttons invisibleMake the Evaluate button visibleEND OF PART BEND OF LABDEVRY CIS170B WEEK 7 ILABQuestion 1. Question: (TCO 1) Because information in _____ is lost when the power is turned off, that type of memory is considered _____.: auxiliary storage, nonvolatileauxiliary storage, volatileRAM, nonvolatileRAM, volatileComments:Question 2. Question: (TCO 1) C# comments are represented by which characters?: // and /* */:: and //// and >>>Comments:Question 3. Question: (TCO 2) Which is not a C# syntax rule?: C# is not case sensitive.Blocks of code are defined by curly braces.Statements must end with a semicolon.Every C# program must have a function named "main."Comments:Question 4. Question: (TCO 1) _____ provides access to programming language definitions within the code editor.: IntellisenseBookmarkBreak pointStep throughComments:Question 5. Question: (TCO 2) _____ enhances a programmer's productivity by providing editing, compiling, and debugging in one software package.: An IDEC#Compiler+MREComments:Question 6. Question: (TCO 2) The analysis phase of software development involves _____.: determining a program's inputs and outputs and the process it will use to to solve the problemwriting the software with a program such as Visual Studio.NET C#testing the solutionBoth A and BComments:Question 7. Question: (TCO 2) What escape sequence is used to produce a new line within a string literal on the output console?: Special characters cannot be added to string literals\t\nreturn characterComments:Question 8. Question: (TCO 2) What is the result of this code segment:int doors = 2,Console.WriteLine("The Car has {0}",doors),: The Car has 2The Car has {0} doorsThe Car has 2 doorsThe statement will not compile.Comments:Question 9. Question: (TCO 3) The proper operator precedence, from first to last, is _____.: subtraction, addition, and multiplicationaddition, subtraction, and multiplicationexponentiation, division, and subtractionexponentiation, addition, and divisionexponentiation, division, and multiplicationComments:Question 10. Question: IDE stands for Integrated Development Environment: TrueFalseComments:Question 11. Question:You can only code using camel casing in the hot desert.: TrueFalseComments:week 2uestion 1. Question:(TCO 4) A car dealership is running a promotion that includes a 25% discount on last year?s models. Which of the following is the appropriate structure to use to determine if a given car fits the criteria for the discount?LoopMethodDecisionSequenceComments:Question 2. Question:(TCO 6) When using the Visual Studio, press _____ to start debugging your program.F5F10F11F15Comments:Question 3. Question:(TCO 6) To cause the Visual Studio debugger to halt execution of your program at a particular statement, set a _____ at that statement.BreakpointLocalsDebugWatchComments:Question 4. Question:(TCO 4) How is a decision structure represented on a flow chart?SquareRectangleCircleDiamondComments:Question 5. Question:(TCO 4) The symbol && is an example of a C# _____ operator.RelationalBooleanLogicalMathematicalComments:Question 6. Question:(TCO 4) Given that a = 5, b = 6, and c = 8, which of the following is false?a == 57 y)Console.Write("B, "),elseConsole.Write("C, "),}elseConsole.Write("D, "),A,A, B,A, D,A, C,Comments:Question 8. Question:(TCO 6) C# code that might create a problem at runtime can be placed in a _____ block. Code to deal with the problem is then placed in a _____ block.catch, finallycatch, trytry, catchtry, finallyComments:Question 9. Question:All IF statements contain a conditional expression that evaluates to true or false.True FalseComments:Question 10. Question:Compile errors and run-time errors mean the same thing.True FalseComments:Question 11. Question:This code is valid:double var = 16.0,if (var > 15 && var < 20)Console.WriteLine("{0} is between 15 and 20", var),elseConsole.WriteLine("{0} is not between 15 and 20", var),True FalseComments:Question 12. Question:2Score is a valid variable name in C#?True FalseComments:week 3Question 1. Question:(TCO 5) When writing a program, if you know exactly how many times statements in a loop should execute, use the _____ structure.do whileforgotowhileInstructor Explanation: With the FOR structure, the programmer specifies the number of iterations the loop will perform.Points Received: 4 of 4Comments:Question 2. Question:(TCO 5) When used within a loop structure, the _____ statement causes execution to jump out of the loop and proceed with subsequent statements in the program.breakcontinuegotojumpInstructor Explanation: BREAK breaks completely out of the loop whereas CONTINUE transfers control to the loop?s conditional expression.Points Received: 4 of 4Comments:Question 3. Question:(TCO 5) A block of statements within the body of a FOR loop must be surrounded with _____.curly braces {}parentheses ()square brackets []None of the aboveInstructor Explanation: Although a loop body containing a single statement needs no braces, several statements must be surrounded with curly braces.Points Received: 4 of 4Comments:Question 4. Question:(TCO 5) What output will this set of statements produce?int a = 1,while (a < 1){Console.Write("{0}\t", a),a++,}Console.Write("{0}\t", a),An infinite loopAn exception11 1Instructor Explanation: Because ?a? will never be less than 1, the WHILE loop will not execute. The value of ?a? will remain 1.Points Received: 4 of 4Comments:Question 5. Question:(TCO 5) In this code, the inner FOR loop _____.int i = 1, j = 1,for (i = 1, i < 4, i++){for (j = 1, j < 4, j++){Console.Write("{0}{1} ", i, j),}}contains a syntax erroris nestedis like a blue skyis like a lightInstructor Explanation: The inner FOR is nested inside the outer FOR, so for every execution of the outer FOR, the inner FOR will execute three times.Points Received: 4 of 4Comments:Question 6. Question:(TCO 5) Your program keeps asking for last names from the user until he/she enters ?####.? In this context, the ?####? is used as a(n) _____.accumulatorcountersentinel valuetest valueInstructor Explanation: A sentinel value is a dummy variable not used for processing. It?s used to signify when a loop should stop executing.Points Received: 4 of 4Comments:Question 7. Question:GOTO statements should be avoided.True FalseInstructor Explanation:Yes, since they are often result in unstructured and confusing code. Break and Continue is a much better choice.Note that GOTO usually works with a Label.Points Received: 4 of 4Comments:Question 8. Question:A walkthrough is a form of software peer review the programmer leads members of the development team through the software code, and the participants ask questions and make comments about possible errors, problems of not adhering to development standards, and other problems.True FalsePoints Received: 4 of 4Comments:Question 9. Question:Accumulators and counters mean the same thing.True FalsePoints Received: 4 of 4Comments:Question 10. Question:Nesting or indenting multiple programming loops is a good coding practice.True FalsePoints Received: 4 of 4Comments:Question 11. Question:The For Loop is used when the user wishes to stop the Loop from executing, and is used when the number of Loop Executions is unknown.True FalsePoints Received: 4 of 4Comments:week 4(TCO 8) Which words belong in the blank to indicate that the method PerformCalcs() returns an integer to the calling method, and that the method has no restrictions on accessibility?_____ PerformCalcs()private static intpublic static intprivate static voidpublic static voidComments:Question 2. Question:(TCO 7) Which is not a valid name for a method or function?1modmod_1MyModmod1Comments:Question 3. Question:(TCO 8) The following method has _____ input parameter(s) and returns _____ to the calling method.Public static int GetResult(int value1, double value2)2, an integer2, no valuean integer, an integer1, an integerComments:Question 4. Question:The following will return a value of type int:public static int CalcDiff(int price1, int price2),True FalseComments:Question 5. Question:The following code is correct:int myInteger = getWidgets(int myWidgets)True FalseComments:Question 6. Question:Overloaded methods must share the same name and the parameters they accept must differ in number and/or data type. They can return different data types.True FalseComments:Question 7. Question:Local variables can only be accessed by the method that declares them. Global variables can be accessed by any method.True FalseComments:Question 8. Question:void means that the method has a return value.True FalseComments:Question 9. Question:In the code below, Math is a Class:Math.Sum(),True FalseComments:Question 10. Question:My mod is a valid method nameTrue FalseComments:week 5(TCO 11) An array is a list of data items that _____.share the same data typeare all integershave different facesthe different flavorsComments:Question 2. Question:(TCO 11) Which statement is true about this array declaration?int [] myArray = {1,4,3,5,6},It declares a 5 dimensional array.The size of the array is five.It sets the element myArray[1] to 1.It won't compile due to a syntax error.Comments:Question 3. Question:(TCO 11) What will be the output of this code?int[] size = {2,3,5,6,4,5},Array.Sort(size),foreach (intval in size)Console.Write("{0} ", val),2 3 5 6 4 55 4 6 5 3 26 5 5 4 3 22 3 4 5 5 6Comments:Question 4. Question:(TCO 11) When a single array element, such as myArray[2], is passed to a method, the method receives _____.a copy of the arraythe starting address of the arraythe address of the elementa copy of the value in the elementComments:Question 5. Question:(TCO 12) The size of a(n) _____ must be determined when the program is written, whereas elements of a(n) _____ can be added or deleted at runtime.array, ArrayListArrayList, arrayarray, Array classArrayList, Array classComments:Question 6. Question:(TCO 12) In your program, myList was declared as an ArrayList. To append the number 7 to the end of myList, write _____.myList.Add(7),myList.Append(7),myList.Insert(7),myList.Set(7),Comments:Question 7. Question:This is a valid statement:decimal [] price = new decimal[5],True FalseComments:Question 8. Question:In the following, we can code height[1,1] in a two-dimensional array that will have valueslike this (this is partial code): height = { {2.1, 3.2, 6.5, 7.2},{5.4, 6.7, 3.5, 3.6} },True FalseComments:Question 9. Question:The following is valid code for a one-dimensional array:int[] size = {2,3,5,6,4,5},True FalseComments:Question 10. Question:ArrayList ?Count? property to give the user the current number of integers with a value of '1' in TempArray.True Falseweek 6Question 1. Question: (TCO 9) A(n) _____ is a notification from the _____ that an action has occurred, such as a mouse click or a key press.event, operating systemconsole application, operating systemGUI application, eventevent, GUI applicationComments:Question 2. Question: (TCO 9) Although a _____ usually accepts text input from the user, it can also be used to display text.ComboBoxLabelMessageBoxTextBoxComments:Question 3. Question: (TCO 9) The first time a programmer double-clicks on a TextBox object in Design Mode, the TextBox?s default event handler method _____ is added to the code.Click()Enter()Text()TextChanged()Comments:Question 4. Question: (TCO 9) Type _____ to append ?New Year?s Day? to an existing list of holidays in the ?listHolidays? ListBox object at runtime.listHolidays.Items.Add(?New Year?s Day?),listHolidays.Items.Append(?New Year?s Day?),listHolidays.Add(?New Year?s Day?),listHolidays.Append(?New Year?s Day?),Comments:Question 5. Question: (TCO 9) Which of the following statements will retrieve the selected item of a ComboBox called ?cmboWines? and place it in a string variable called ?str??string str = cmboWines.SelectedItem,string str = cmboWines.Selection(),string str = cmboWines.Text,string str = cmboWines.getText(),Comments:Question 6. Question: A Button is also known as a Form Control.TrueFalseComments:Question 7. Question: Form controls include Buttons, Needles, Labels, and Textboxes.TrueFalseComments:Question 8. Question: A Label object is normally used to provide descriptive text or a label for another control.TrueFalseComments:Question 9. Question: Because it is the most common event associated with a Form, the default event handler method for a Form object is Load().TrueFalseComments:Question 10. Question: The Text property determines the text that will appear on a Label when the Windows application starts running.TrueFalseComments:week 7(TCO 13) Include the _____ namespace in your C# program to enable it to access files and directories.Student Answer: System.IOSystem.Collections.GenericSystemSystem.TextComments:Question 2. Question:(TCO 13) Before your C# program attempts to open a file, it should first _____.Student Answer: call File.Open() to make sure the file can be openedcall File.Exists() to make sure the file existscall File.Create() to create the filecall File.Close() to close the file in case it was already openComments:Question 3. Question:(TCO 13) To make your C# program put a new file called "newFile.txt" in the current directory, write _____.Student Answer: File.Create("newFile.txt"),File.CreateNew("newFile.txt"),File myFile = new File("newFile.txt"),File myFile = new FileStream("newFile.txt"),Comments:Question 4. Question:(TCO 13) The following C# code will print out _____.DirectoryInfo dir = newDirectoryInfo("."),foreach (FileInfofil in dir.GetFiles("*.*"))Console.WriteLine(fil.Name),Student Answer: the names of all objects in a programthe names of the methods in a programthe names of all of the variables in a programthe names of all files in the current directoryComments:Question 5. Question:The GetCreationTime() method of the File class returns a string containing the date and time a specified file was created.True FalseComments:Question 6. Question:The StreamReader and StreamWriter classes simplify the process of reading and writing to text files.True FalseComments:Question 7. Question:Because many runtime errors are possible when accessing system resources such as files, it is not important to catch and handle exceptions that may be thrown.True FalseComments:Question 8. Question:The Close() method of the SystemWriter class causes any data in the buffer to be written to the file, and releases any resources associated with the file, such as memory.True False

 

Paper#36418 | Written in 18-Jul-2015

Price : $97
SiteLock