Name: Class: Date: 2. Today, a bug refers to any sort of problem in the design and operation of a program.

Similar documents
5/19/2015. Objectives. JavaScript, Sixth Edition. Understanding Syntax Errors. Introduction to Debugging. Handling Run-Time Errors

Online Activity: Debugging and Error Handling

Object Oriented Programming Exception Handling

Program Correctness and Efficiency. Chapter 2

Handle Web Application Errors

Lecture 20. Java Exceptional Event Handling. Dr. Martin O Connor CA166

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 7

CSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige

2 rd class Department of Programming. OOP with Java Programming

CHAPTER 2. Troubleshooting CGI Scripts

CS-152: Software Testing

Testing and Debugging

Exam Questions Demo Microsoft. Exam Questions

After completing this appendix, you will be able to:

Chapter 8: Error Handling and Debugging

Chapter 9: Dealing with Errors

Lecture 14: Exceptions 10:00 AM, Feb 26, 2018

Exceptions in Java

Assertions, pre/postconditions

Supplemental Handout: Exceptions CS 1070, Spring 2012 Thursday, 23 Feb 2012

Programming Fundamentals

The compiler is spewing error messages.

Computer Components. Software{ User Programs. Operating System. Hardware

Debugging and Handling Exceptions

Soda Machine Laboratory

Largest Online Community of VU Students

12/14/2016. Errors. Debugging and Error Handling. Run-Time Errors. Debugging in C# Debugging in C# (continued)

CSE 331 Midterm Exam Sample Solution 2/13/12

CS 3 Introduction to Software Engineering. 3: Exceptions

Object Oriented Programming. Week 7 Part 1 Exceptions

Final Examination May 5, 2005

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1

Total Score /15 /20 /30 /10 /5 /20 Grader

Defensive Programming. Ric Glassey

Exceptions. Produced by. Algorithms. Eamonn de Leastar Department of Computing, Maths & Physics Waterford Institute of Technology

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

11Debugging and Handling. C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies

Introduction to Programming Using Java (98-388)

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CS16 Exam #1 7/17/ Minutes 100 Points total

Checked and Unchecked Exceptions in Java

About this exam review

Total Score /15 /20 /30 /10 /5 /20 Grader

Introduction to Problem Solving and Programming in Python.

Result: original lp in main is. Goal was.

COMP1730/COMP6730 Programming for Scientists. Testing and Debugging.

Day 8. COMP1006/1406 Summer M. Jason Hinek Carleton University

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

CSCI-142 Exam 2 Review November 2, 2018 Presented by the RIT Computer Science Community

QUIZ. What is wrong with this code that uses default arguments?

Reliable programming

Errors and Exceptions

Programming II (CS300)

3 The Building Blocks: Data Types, Literals, and Variables

Exceptions. Examples of code which shows the syntax and all that

CS2: Debugging in Java


Assertions and Exceptions Lecture 11 Fall 2005

Microsoft Exam

Test suites Obviously you have to test your code to get it working in the first place You can do ad hoc testing (testing whatever occurs to you at

Fun facts about recursion

16-Dec-10. Consider the following method:

Exception Handling. Sometimes when the computer tries to execute a statement something goes wrong:

Std 12 Lesson-10 Exception Handling in Java ( 1

Exception Handling. Run-time Errors. Methods Failure. Sometimes when the computer tries to execute a statement something goes wrong:

Correctness and Robustness

COMP 213. Advanced Object-oriented Programming. Lecture 17. Exceptions

CS 231 Data Structures and Algorithms, Fall 2016

Exceptions. Errors and Exceptions. Dealing with exceptions. What to do about errors and exceptions

Programming II (CS300)

EXCEPTION HANDLING. Summer 2018

CSCI-140 Midterm Review October 10, 2015 Presented by the RIT Computer Science Community

Interface evolution via public defender methods

Exceptions and Error Handling

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.

5 When a program calls a function, in which type of data structure is memory allocated for the variables in that function?

Absolute C++ Walter Savitch

6.Introducing Classes 9. Exceptions

Exceptions, Case Study-Exception handling in C++.

CS 61B Data Structures and Programming Methodology. July 7, 2008 David Sun

INTERNATIONAL EDITION. Problem Solving with C++ Data Abstraction & SIXTH EDITION. Walls and Mirrors. Frank M. Carrano Timothy Henry

Main concepts to be covered. Handling errors. Some causes of error situations. Not always programmer error. Defensive programming.

Video 2.1. Arvind Bhusnurmath. Property of Penn Engineering, Arvind Bhusnurmath. SD1x-2 1

Q&As. Microsoft MTA Software Development Fundamentals. Pass Microsoft Exam with 100% Guarantee

UNIT 3

Stacks and Queues. Gregory D. Weber. CSCI C243 Data Structures

MPLAB X Debugging Techniques

Exceptions. Produced by. Introduction to the Java Programming Language. Eamonn de Leastar

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED

TESTING, DEBUGGING, EXCEPTIONS, ASSERTIONS

Testing is a very big and important topic when it comes to software development. Testing has a number of aspects that need to be considered.

Debugging Code in Access 2002

Exploring Code with Microsoft Pex

class Polynomial { public: Polynomial(const string& N = "no name", const vector<int>& C = vector<int>());... };

Exception-Handling Overview

COMP1730/COMP6730 Programming for Scientists. Exceptions and exception handling

Modular and Verified Automatic Program Repairs

Programming for the Web with PHP

Transcription:

Name: Class: Date: Chapter 6 Test Bank True/False Indicate whether the statement is true or false. 1. You might be able to write statements using the correct syntax, but be unable to construct an entire, logically executed program that works the way you want. 2. Today, a bug refers to any sort of problem in the design and operation of a program. 3. Syntax errors can be caused by incorrect logic or references to objects, methods, and variables that do not exist. 4. Logic errors generate compiler errors. 5. Some compiler error messages do not exactly identify the cause of a compiler error. 6. Run-time errors differ from syntax errors in that they do not necessarily represent C# language errors. 7. To print detailed information about errors to the browser window for a particular Web page, you need to include the Error attribute in the @ Page directive and assign it a value of true. 8. When you are unable to locate a bug in your program by using error messages or examining your code, or if you suspect a logic error, you can try tracing your code manually. 9. The key to using multiple Response.Write() statements to trace program values is using them selectively at key points throughout a program. 10. When you first receive an error message or your program doesn t work as expected, start by commenting out all of the statements surrounding those specified by the line number in the error message. 11. When searching for errors, it s often helpful to combine debugging techniques. 12. When you suspect that your code contains logic errors, you must analyze each statement on a case-by-case basis. 13. With diagnostic tracing, you must always remove any Trace.Write() and Trace.Warn() methods from your code before deploying your application. 14. When you first enter break mode, two new windows, Locals and Watch, appear at the bottom of the Visual Studio IDE. 15. You can make changes to code in break mode that will take effect while the program is executing. 16. To open the Immediate window, point to Windows on the Debug menu and then click Immediate. 17. The term bulletproofing indicates that something unexpected occurred while a program is running. 1

Name: 18. The exception objects that are thrown from a try statement contain several properties and methods that describe what went wrong. 19. A catch statement is constructed with one or more parameters of the thrown exception type. 20. If the thrown exception is within a try block, the compiler checks the catch block for an additional try statement. 21. Your goal as a good ASP.NET programmer is to prevent visitors to your Web site from seeing the default error page, which can be extremely confusing to nonprogrammers. 22. A try statement can only contain one catch block. 23. The most basic method of handling errors at the page level is to assign an error page to the ErrorPage attribute of the @ Page directive. 24. The statements that you use to handle errors at the application level are the same as the page level. 25. You can include Response.Write() and other types of output statements in the Global.asax file. Multiple Choice Identify the choice that best completes the statement or answers the question. 26. All programming languages, including C#, have their own, or rules. a. protocols c. semantics b. syntax d. structure 27. The term refers to the order in which various parts of a program run, or execute. a. algorithm c. logic b. structure d. reason 28. Any error in a program that causes it to function incorrectly, whether because of incorrect syntax or flaws in logic, is called a. a. bug c. flaw b. feature d. splinter 29. The term refers to the act of tracing and resolving errors in a program. a. decoding c. deciphering b. debugging d. displacing 30. occur when the interpreter fails to recognize code. a. Runtime errors c. Logic errors b. Link errors d. Syntax errors 31. The statement response.write("hello World"); causes a syntax error because. a. the Response object is incorrectly typed with a lowercase r b. the statement should be write.response c. the literal should be in single quotes d. there is no such method as write for the response object 2

Name: 32. are flaws in a program s design that prevent the program from running as you anticipate. a. Syntax errors c. Logic errors b. Link errors d. Runtime errors 33. To trace a problem, you can place a statement at the point in the program where you think the error might be located. a. Response.Console() c. Response.Log() b. Response.Write() d. Response.Print() 34. A is a simplified, temporary program that is used for testing functions and other code. a. loader program c. bootstrap program b. stripped program d. driver program 35. are empty functions that serve as placeholders for a program s actual functions. a. Null functions c. Void functions b. Stub functions d. Rough functions 36. The window displays all local variables within the currently executing function, regardless of whether they have been initialized. a. Locals c. Immediate b. Globals d. Watch 37. The monitors both variables and expressions in break mode. a. Locals window c. Watch window b. Globals window d. Immediate window 38. You can use the window to monitor specific variables and expressions in break mode. a. Locals c. Watch b. Global d. Immediate 39. The term call refers to the order in which procedures, such as functions, methods, or event handlers, execute in a program. a. heap c. block b. stack d. queue 40. Writing code that anticipates and handles potential problems is often called. a. compensating c. hardening b. restructuring d. bulletproofing 41. The process by which a try statement generates an exception class object is referred to as. a. throwing an exception c. popping an assertion b. asserting d. popping the stack 42. You can manually throw an exception by using a(n) statement and an Exception object. a. assert c. throw b. handle d. catch 43. After you throw an error, you use a(n) statement to handle the exception object. a. catch c. assert b. throw d. handle 3

Name: 44. The exception-handling functionality in C# also includes a(n) statement that executes regardless of whether its associated try block throws an exception. a. allelse c. else b. finally d. allothers 45. To redirect the Web browser to an error page from an error event handler, you must pass the name of the page to the method. a. System.Redirect() c. System.Transpose() b. System.Rewrite() d. System.Transfer() 46. To pass an error to a page error event handler, you must throw it from the. a. object level c. code level b. system level d. server level 47. You use the method to redirect users to a generic error page. a. System.Transfer() c. System.ClearError() b. System.LastError() d. Server.Transfer() 48. You use the method to clear errors. a. System.Transfer() c. Server.ClearError() b. System.ClearError() d. Server.Clear() 49. You use the method to access the last exception that occurred. a. System.LastError() c. System.GetLastError() b. Server.GetLastError() d. Server.LastError() 50. Unlike page error event handlers, application errors are handled in the file, which contains event handlers for handling application events. a. Master.asax c. Global.aspx b. Default.aspx d. Global.asax 4

Chapter 6 Test Bank Answer Section TRUE/FALSE 1. ANS: T PTS: 1 REF: 310 2. ANS: T PTS: 1 REF: 310 3. ANS: F PTS: 1 REF: 310 4. ANS: F PTS: 1 REF: 311 5. ANS: T PTS: 1 REF: 311 6. ANS: T PTS: 1 REF: 314 7. ANS: F PTS: 1 REF: 317 8. ANS: T PTS: 1 REF: 320 9. ANS: T PTS: 1 REF: 322 10. ANS: F PTS: 1 REF: 324 11. ANS: T PTS: 1 REF: 327 12. ANS: T PTS: 1 REF: 328 13. ANS: F PTS: 1 REF: 332 14. ANS: T PTS: 1 REF: 335 15. ANS: F PTS: 1 REF: 336 16. ANS: T PTS: 1 REF: 341 17. ANS: F PTS: 1 REF: 345 18. ANS: T PTS: 1 REF: 346 19. ANS: F PTS: 1 REF: 347 20. ANS: F PTS: 1 REF: 347 21. ANS: T PTS: 1 REF: 347 22. ANS: F PTS: 1 REF: 348 23. ANS: T PTS: 1 REF: 350 24. ANS: T PTS: 1 REF: 351 25. ANS: F PTS: 1 REF: 352 MULTIPLE CHOICE 26. ANS: B PTS: 1 REF: 310 27. ANS: C PTS: 1 REF: 310 28. ANS: A PTS: 1 REF: 310 29. ANS: B PTS: 1 REF: 310 30. ANS: D PTS: 1 REF: 310 31. ANS: A PTS: 1 REF: 311 32. ANS: C PTS: 1 REF: 315 33. ANS: B PTS: 1 REF: 321 34. ANS: D PTS: 1 REF: 324 35. ANS: B PTS: 1 REF: 324 36. ANS: A PTS: 1 REF: 339 37. ANS: C PTS: 1 REF: 340 1

38. ANS: D PTS: 1 REF: 341 39. ANS: B PTS: 1 REF: 344 40. ANS: D PTS: 1 REF: 345 41. ANS: A PTS: 1 REF: 345 42. ANS: C PTS: 1 REF: 346 43. ANS: A PTS: 1 REF: 346 44. ANS: B PTS: 1 REF: 349 45. ANS: D PTS: 1 REF: 350 46. ANS: C PTS: 1 REF: 350 47. ANS: A PTS: 1 REF: 351 48. ANS: C PTS: 1 REF: 351 49. ANS: B PTS: 1 REF: 351 50. ANS: D PTS: 1 REF: 351 2

Chapter 6 Test Bank [Answer Strip] _ T 18. _ C 32. _ B 44. _ T 1. _ F 19. _ F 20. _ B 33. _ D 45. _ T 2. _ F 3. _ F 4. _ T 21. _ F 22. _ T 23. _ D 34. _ B 35. _ C 46. _ A 47. _ T 5. _ T 6. _ T 24. _ F 25. _ A 36. _ C 48. _ F 7. _ C 37. _ B 49. _ T 8. _ B 26. _ D 38. _ D 50. _ T 9. _ C 27. _ B 39. _ F 10. _ T 11. _ A 28. _ D 40. _ T 12. _ F 13. _ B 29. _ A 41. _ T 14. _ D 30. _ C 42. _ F 15. _ A 31. _ A 43. _ T 16. _ F 17.