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

Size: px
Start display at page:

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

Transcription

1 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 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

2 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 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

3 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

4 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

5 Chapter 6 Test Bank Answer Section TRUE/FALSE 1. ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: ANS: T PTS: 1 REF: ANS: T PTS: 1 REF: ANS: F PTS: 1 REF: 352 MULTIPLE CHOICE 26. ANS: B PTS: 1 REF: ANS: C PTS: 1 REF: ANS: A PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: ANS: A PTS: 1 REF: ANS: C PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: ANS: B PTS: 1 REF: ANS: A PTS: 1 REF: ANS: C PTS: 1 REF: 340 1

6 38. ANS: D PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: ANS: A PTS: 1 REF: ANS: C PTS: 1 REF: ANS: A PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: ANS: C PTS: 1 REF: ANS: A PTS: 1 REF: ANS: C PTS: 1 REF: ANS: B PTS: 1 REF: ANS: D PTS: 1 REF: 351 2

7 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.

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

5/19/2015. Objectives. JavaScript, Sixth Edition. Understanding Syntax Errors. Introduction to Debugging. Handling Run-Time Errors Objectives JavaScript, Sixth Edition Chapter 4 Debugging and Error Handling When you complete this chapter, you will be able to: Recognize error types Trace errors with dialog boxes and the console Use

More information

Online Activity: Debugging and Error Handling

Online Activity: Debugging and Error Handling Online Activity: Debugging and Error Handling In this activity, you are to carry a number of exercises that introduce you to the world of debugging and error handling in ASP.NET using C#. Copy the application

More information

Object Oriented Programming Exception Handling

Object Oriented Programming Exception Handling Object Oriented Programming Exception Handling Budditha Hettige Department of Computer Science Programming Errors Types Syntax Errors Logical Errors Runtime Errors Syntax Errors Error in the syntax of

More information

Program Correctness and Efficiency. Chapter 2

Program Correctness and Efficiency. Chapter 2 Program Correctness and Efficiency Chapter 2 Chapter Objectives To understand the differences between the three categories of program errors To understand the effect of an uncaught exception and why you

More information

Handle Web Application Errors

Handle Web Application Errors Handle Web Application Errors Lesson Overview In this lesson, you will learn about: Hypertext Transfer Protocol (HTTP) error trapping Common HTTP errors HTTP Error Trapping Error handling in Web applications

More information

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

Lecture 20. Java Exceptional Event Handling. Dr. Martin O Connor CA166 Lecture 20 Java Exceptional Event Handling Dr. Martin O Connor CA166 www.computing.dcu.ie/~moconnor Topics What is an Exception? Exception Handler Catch or Specify Requirement Three Kinds of Exceptions

More information

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

Object oriented programming. Instructor: Masoud Asghari Web page:   Ch: 7 Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 7 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Essential

More information

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

CSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige CSC 308 2.0 System Development with Java Exception Handling Department of Statistics and Computer Science 1 2 Errors Errors can be categorized as several ways; Syntax Errors Logical Errors Runtime Errors

More information

2 rd class Department of Programming. OOP with Java Programming

2 rd class Department of Programming. OOP with Java Programming 1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach

More information

CHAPTER 2. Troubleshooting CGI Scripts

CHAPTER 2. Troubleshooting CGI Scripts CHAPTER 2 Troubleshooting CGI Scripts OVERVIEW Web servers and their CGI environment can be set up in a variety of ways. Chapter 1 covered the basics of the installation and configuration of scripts. However,

More information

CS-152: Software Testing

CS-152: Software Testing CS-152: Software Testing Neal Holtschulte July 2, 2013 Software Testing Outline Terminology Assertions and when to use them Try-catch and when to use them What are Exceptions Further resources Practice

More information

Testing and Debugging

Testing and Debugging COS226 - Spring 2018 Class Meeting # 3 February 12, 2018 Testing and Debugging Tips & Tricks Ibrahim Albluwi COS 126 Unofficial Coding Strategy Repeat Until Deadline : Hack! Click Check All Submitted Files

More information

Exam Questions Demo Microsoft. Exam Questions

Exam Questions Demo   Microsoft. Exam Questions Microsoft Exam Questions 98-361 Microsoft MTA Software Development Fundamentals Version:Demo 1. This question requires that you evaluate the underlined text to determine if it is correct. To minimize the

More information

After completing this appendix, you will be able to:

After completing this appendix, you will be able to: 1418835463_AppendixA.qxd 5/22/06 02:31 PM Page 879 A P P E N D I X A A DEBUGGING After completing this appendix, you will be able to: Describe the types of programming errors Trace statement execution

More information

Chapter 8: Error Handling and Debugging

Chapter 8: Error Handling and Debugging IT215 Web Programming 1 Chapter 8: Error Handling and Debugging Jakkrit TeCho, Ph.D. Business Information Technology (BIT), Maejo University Phrae Campus Objectives Study debugging concepts Handle and

More information

Chapter 9: Dealing with Errors

Chapter 9: Dealing with Errors Chapter 9: Dealing with Errors What we will learn: How to identify errors Categorising different types of error How to fix different errors Example of errors What you need to know before: Writing simple

More information

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

Lecture 14: Exceptions 10:00 AM, Feb 26, 2018 CS18 Integrated Introduction to Computer Science Fisler, Nelson Lecture 14: Exceptions 10:00 AM, Feb 26, 2018 Contents 1 Exceptions and How They Work 1 1.1 Update to the Banking Example.............................

More information

Exceptions in Java

Exceptions in Java Exceptions in Java 3-10-2005 Opening Discussion Do you have any questions about the quiz? What did we talk about last class? Do you have any code to show? Do you have any questions about the assignment?

More information

Assertions, pre/postconditions

Assertions, pre/postconditions Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What

More information

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

Supplemental Handout: Exceptions CS 1070, Spring 2012 Thursday, 23 Feb 2012 Supplemental Handout: Exceptions CS 1070, Spring 2012 Thursday, 23 Feb 2012 1 Objective To understand why exceptions are useful and why Visual Basic has them To gain experience with exceptions and exception

More information

Programming Fundamentals

Programming Fundamentals Programming Fundamentals Computers are really very dumb machines -- they only do what they are told to do. Most computers perform their operations on a very primitive level. The basic operations of a computer

More information

The compiler is spewing error messages.

The compiler is spewing error messages. Appendix B Debugging There are a few different kinds of errors that can occur in a program, and it is useful to distinguish between them in order to track them down more quickly. Compile-time errors are

More information

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

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

Debugging and Handling Exceptions

Debugging and Handling Exceptions 12 Debugging and Handling Exceptions C# Programming: From Problem Analysis to Program Design C# Programming: From Problem Analysis to Program Design 1 4th Edition Chapter Objectives Learn about exceptions,

More information

Soda Machine Laboratory

Soda Machine Laboratory Soda Machine Laboratory Introduction This laboratory is intended to give you experience working with multiple queue structures in a familiar real-world setting. The given application models a soda machine

More information

Largest Online Community of VU Students

Largest Online Community of VU Students WWW.VUPages.com http://forum.vupages.com WWW.VUTUBE.EDU.PK Largest Online Community of VU Students MIDTERM EXAMINATION SEMESTER FALL 2003 CS301-DATA STRUCTURE Total Marks:86 Duration: 60min Instructions

More information

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

12/14/2016. Errors. Debugging and Error Handling. Run-Time Errors. Debugging in C# Debugging in C# (continued) Debugging and Error Handling Debugging methods available in the ID Error-handling techniques available in C# Errors Visual Studio IDE reports errors as soon as it is able to detect a problem Error message

More information

CSE 331 Midterm Exam Sample Solution 2/13/12

CSE 331 Midterm Exam Sample Solution 2/13/12 Question 1. (14 points) (assertions) Using backwards reasoning, find the weakest precondition for each sequence of statements and postcondition below. Insert appropriate assertions in each blank line.

More information

CS 3 Introduction to Software Engineering. 3: Exceptions

CS 3 Introduction to Software Engineering. 3: Exceptions CS 3 Introduction to Software Engineering 3: Exceptions Questions? 2 Objectives Last Time: Procedural Abstraction This Time: Procedural Abstraction II Focus on Exceptions. Starting Next Time: Data Abstraction

More information

Object Oriented Programming. Week 7 Part 1 Exceptions

Object Oriented Programming. Week 7 Part 1 Exceptions Object Oriented Programming Week 7 Part 1 Exceptions Lecture Overview of Exception How exceptions solve unexpected occurrences Catching exceptions Week 7 2 Exceptions Overview Week 7 3 Unexpected Occurances

More information

Final Examination May 5, 2005

Final Examination May 5, 2005 CS 4352 Compilers and Interpreters Final Examination May 5, 2005 Name Closed Book. If you need more space ask for an extra sheet. 1. [4 points] Pick the appropriate data structure for each purpose: storage

More information

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

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1 CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines

More information

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

Total Score /15 /20 /30 /10 /5 /20 Grader NAME: NETID: CS2110 Fall 2009 Prelim 2 November 17, 2009 Write your name and Cornell netid. There are 6 questions on 8 numbered pages. Check now that you have all the pages. Write your answers in the boxes

More information

Defensive Programming. Ric Glassey

Defensive Programming. Ric Glassey Defensive Programming Ric Glassey glassey@kth.se Outline Defensive Programming Aim: Develop the programming skills to anticipate problems beyond control that may occur at runtime Responsibility Exception

More information

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

Exceptions. Produced by. Algorithms. Eamonn de Leastar Department of Computing, Maths & Physics Waterford Institute of Technology Exceptions Algorithms Produced by Eamonn de Leastar edeleastar@wit.ie Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie Exceptions ± Definition

More information

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

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

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

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

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CMSC 201 Fall 2016 Lab 09 Advanced Debugging CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working

More information

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

CS16 Exam #1 7/17/ Minutes 100 Points total CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding

More information

Checked and Unchecked Exceptions in Java

Checked and Unchecked Exceptions in Java Checked and Unchecked Exceptions in Java Introduction In this article from my free Java 8 course, I will introduce you to Checked and Unchecked Exceptions in Java. Handling exceptions is the process by

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

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

Total Score /15 /20 /30 /10 /5 /20 Grader NAME: NETID: CS2110 Fall 2009 Prelim 2 November 17, 2009 Write your name and Cornell netid. There are 6 questions on 8 numbered pages. Check now that you have all the pages. Write your answers in the boxes

More information

Introduction to Problem Solving and Programming in Python.

Introduction to Problem Solving and Programming in Python. Introduction to Problem Solving and Programming in Python http://cis-linux1.temple.edu/~tuf80213/courses/temple/cis1051/ Overview Types of errors Testing methods Debugging in Python 2 Errors An error in

More information

Result: original lp in main is. Goal was.

Result: original lp in main is. Goal was. CSE 12, Week Two, Lecture Two Thursday s Discussion Section: Getting started on hw3 Goal: Call a method that assigns a variable (a long) to zero; that variable exists elsewhere: void func ( ) { ; main

More information

COMP1730/COMP6730 Programming for Scientists. Testing and Debugging.

COMP1730/COMP6730 Programming for Scientists. Testing and Debugging. COMP1730/COMP6730 Programming for Scientists Testing and Debugging. Overview * Testing * Debugging * Defensive Programming Overview of testing * There are many different types of testing - load testing,

More information

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

Day 8. COMP1006/1406 Summer M. Jason Hinek Carleton University Day 8 COMP1006/1406 Summer 2016 M. Jason Hinek Carleton University today s agenda assignments Assignment 4 is out and due on Tuesday Bugs and Exception handling 2 Bugs... often use the word bug when there

More information

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

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1 Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies

More information

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

CSCI-142 Exam 2 Review November 2, 2018 Presented by the RIT Computer Science Community CSCI-142 Exam 2 Review November 2, 2018 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. Suppose we are talking about the depth-first search (DFS) algorithm. Nodes are added to

More information

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

QUIZ. What is wrong with this code that uses default arguments? QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code

More information

Reliable programming

Reliable programming Reliable programming How to write programs that work Think about reliability during design and implementation Test systematically When things break, fix them correctly Make sure everything stays fixed

More information

Errors and Exceptions

Errors and Exceptions Exceptions Errors and Exceptions An error is a bug in your program dividing by zero going outside the bounds of an array trying to use a null reference An exception isn t necessarily your fault trying

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions and

More information

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

3 The Building Blocks: Data Types, Literals, and Variables chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating

More information

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

Exceptions. Examples of code which shows the syntax and all that Exceptions Examples of code which shows the syntax and all that When a method might cause a checked exception So the main difference between checked and unchecked exceptions was that the compiler forces

More information

CS2: Debugging in Java

CS2: Debugging in Java CS2: Debugging in Java 1. General Advice Jon Cook (LFCS) April 2003 Debugging is not always easy. Some bugs can take a long time to find. Debugging concurrent code can be particularly difficult and time

More information

Symbol Tables Symbol Table: In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is

More information

Assertions and Exceptions Lecture 11 Fall 2005

Assertions and Exceptions Lecture 11 Fall 2005 Assertions and Exceptions 6.170 Lecture 11 Fall 2005 10.1. Introduction In this lecture, we ll look at Java s exception mechanism. As always, we ll focus more on design issues than the details of the language,

More information

Microsoft Exam

Microsoft Exam Volume: 72 Questions Question: 1 You are developing an ASP.NET MVC application that uses forms authentication. The user database contains a user named LibraryAdmin. You have the following requirements:.

More information

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

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 JUnit 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 the moment), or You can build a test suite (a thorough

More information

Fun facts about recursion

Fun facts about recursion Outline examples of recursion principles of recursion review: recursive linked list methods binary search more examples of recursion problem solving using recursion 1 Fun facts about recursion every loop

More information

16-Dec-10. Consider the following method:

16-Dec-10. Consider the following method: Boaz Kantor Introduction to Computer Science IDC Herzliya Exception is a class. Java comes with many, we can write our own. The Exception objects, along with some Java-specific structures, allow us to

More information

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

Exception Handling. Sometimes when the computer tries to execute a statement something goes wrong: Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception Ariel Shamir 1 Run-time Errors Sometimes when the computer

More information

Std 12 Lesson-10 Exception Handling in Java ( 1

Std 12 Lesson-10 Exception Handling in Java (  1 Ch-10 : Exception Handling in Java 1) It is usually understood that a compiled program is error free and will always successfully. (a) complete (b) execute (c) perform (d) accomplish 2) In few cases a

More information

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

Exception Handling. Run-time Errors. Methods Failure. Sometimes when the computer tries to execute a statement something goes wrong: Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception 22 November 2007 Ariel Shamir 1 Run-time Errors Sometimes

More information

Correctness and Robustness

Correctness and Robustness Correctness and Robustness 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda Introduction

More information

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

COMP 213. Advanced Object-oriented Programming. Lecture 17. Exceptions COMP 213 Advanced Object-oriented Programming Lecture 17 Exceptions Errors Writing programs is not trivial. Most (large) programs that are written contain errors: in some way, the program doesn t do what

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

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

Exceptions. Errors and Exceptions. Dealing with exceptions. What to do about errors and exceptions Errors and Exceptions Exceptions An error is a bug in your program dividing by zero going outside the bounds of an array trying to use a null reference An exception is a problem whose cause is outside

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions

More information

EXCEPTION HANDLING. Summer 2018

EXCEPTION HANDLING. Summer 2018 EXCEPTION HANDLING Summer 2018 EXCEPTIONS An exception is an object that represents an error or exceptional event that has occurred. These events are usually errors that occur because the run-time environment

More information

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

CSCI-140 Midterm Review October 10, 2015 Presented by the RIT Computer Science Community CSCI-140 Midterm Review October 10, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. In each of the following situations, would it be better to use array-backed storage or

More information

Interface evolution via public defender methods

Interface evolution via public defender methods Interface evolution via public defender methods Brian Goetz Second draft, May 2010 1. Problem statement Once published, it is impossible to add methods to an interface without breaking existing implementations.

More information

Exceptions and Error Handling

Exceptions and Error Handling Exceptions and Error Handling Michael Brockway January 16, 2015 Some causes of failures Incorrect implementation does not meet the specification. Inappropriate object request invalid index. Inconsistent

More information

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

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d. Gaddis: Starting Out with Python, 2e - Test Bank Chapter Two MULTIPLE CHOICE 1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical

More information

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

5 When a program calls a function, in which type of data structure is memory allocated for the variables in that function? 1 The finally block of an exception handler is: -executed when an exception is thrown -always executed when the code leaves any part of the Try statement -always executed -always executed when the code

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

6.Introducing Classes 9. Exceptions

6.Introducing Classes 9. Exceptions 6.Introducing Classes 9. Exceptions Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 Learning

More information

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

Exceptions, Case Study-Exception handling in C++. PART III: Structuring of Computations- Structuring the computation, Expressions and statements, Conditional execution and iteration, Routines, Style issues: side effects and aliasing, Exceptions, Case

More information

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

CS 61B Data Structures and Programming Methodology. July 7, 2008 David Sun CS 61B Data Structures and Programming Methodology July 7, 2008 David Sun Announcements You ve started (or finished) project 1, right? Package Visibility public declarations represent specifications what

More information

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

INTERNATIONAL EDITION. Problem Solving with C++ Data Abstraction & SIXTH EDITION. Walls and Mirrors. Frank M. Carrano Timothy Henry INTERNATIONAL EDITION Data Abstraction & Problem Solving with C++ Walls and Mirrors SIXTH EDITION Frank M. Carrano Timothy Henry Operator Meaning Associativity Usage * multiply left expr * expr / divide

More information

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

Main concepts to be covered. Handling errors. Some causes of error situations. Not always programmer error. Defensive programming. Main concepts to be covered Handling errors Or, When Bad Things Happen to Good Programs Defensive programming. Anticipating that things could go wrong. Exception handling and throwing. Error reporting.

More information

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

Video 2.1. Arvind Bhusnurmath. Property of Penn Engineering, Arvind Bhusnurmath. SD1x-2 1 Video 2.1 Arvind Bhusnurmath SD1x-2 1 Topics Why is testing important? Different types of testing Unit testing SD1x-2 2 Software testing Integral part of development. If you ship a software with bugs,

More information

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

Q&As. Microsoft MTA Software Development Fundamentals. Pass Microsoft Exam with 100% Guarantee 98-361 Q&As Microsoft MTA Software Development Fundamentals Pass Microsoft 98-361 Exam with 100% Guarantee Free Download Real Questions & Answers PDF and VCE file from: 100% Passing Guarantee 100% Money

More information

UNIT 3

UNIT 3 UNIT 3 Presentation Outline Sequence control with expressions Conditional Statements, Loops Exception Handling Subprogram definition and activation Simple and Recursive Subprogram Subprogram Environment

More information

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

Stacks and Queues. Gregory D. Weber. CSCI C243 Data Structures Stacks and Queues Gregory D. Weber CSCI C243 Data Structures Principal Points 1. The Stack interface: how to declare it, what it does. 2. Generics: why they were added to Java, how to use them. 3. The

More information

MPLAB X Debugging Techniques

MPLAB X Debugging Techniques TLS0102-001 MPLAB X Debugging Techniques The Debugging Process Author: Rob Ostapiuk, Stu Chandler Microchip Technology Objectives! Describe a generic process for debugging a program! Describe at a high

More information

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

Exceptions. Produced by. Introduction to the Java Programming Language. Eamonn de Leastar Exceptions Introduction to the Java Programming Language Produced by Eamonn de Leastar edeleastar@wit.ie Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

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

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer

More information

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

엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED 엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED Outline - Interfaces - An Instrument interface - Multiple Inheritance

More information

TESTING, DEBUGGING, EXCEPTIONS, ASSERTIONS

TESTING, DEBUGGING, EXCEPTIONS, ASSERTIONS TESTING, DEBUGGING, EXCEPTIONS, ASSERTIONS (download slides and.py files and follow along!) 6.0001 LECTURE 7 6.0001 LECTURE 7 1 WE AIM FOR HIGH QUALITY AN ANALOGY WITH SOUP You are making soup but bugs

More information

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.

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. Testing 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. System stability is the system going to crash or not?

More information

Debugging Code in Access 2002

Debugging Code in Access 2002 0672321025 AppA 10/24/01 3:53 PM Page 1 Debugging Code in Access 2002 APPENDIX A IN THIS APPENDIX Setting the Correct Module Options for Maximum Debugging Power 2 Using the Immediate Window 6 Stopping

More information

Exploring Code with Microsoft Pex

Exploring Code with Microsoft Pex Exploring Code with Microsoft Pex Tutorial for Automated Whitebox Testing for.net Applications Abstract Microsoft Pex 2010 is a Microsoft Visual Studio add-in that provides a runtime code analysis tool

More information

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

class Polynomial { public: Polynomial(const string& N = no name, const vector<int>& C = vector<int>());... }; Default Arguments 1 When declaring a C++ function, you may optionally specify a default value for function parameters by listing initializations for them in the declaration: class Polynomial { public:

More information

Exception-Handling Overview

Exception-Handling Overview م.عبد الغني أبوجبل Exception Handling No matter how good a programmer you are, you cannot control everything. Things can go wrong. Very wrong. When you write a risky method, you need code to handle the

More information

COMP1730/COMP6730 Programming for Scientists. Exceptions and exception handling

COMP1730/COMP6730 Programming for Scientists. Exceptions and exception handling COMP1730/COMP6730 Programming for Scientists Exceptions and exception handling Lecture outline * Errors * The exception mechanism in python * Causing exceptions (assert and raise) * Handling exceptions

More information

Modular and Verified Automatic Program Repairs

Modular and Verified Automatic Program Repairs Modular and Verified Automatic Program Repairs from Francesco Logozzo and Thomas Ball at Microsoft Research, Redmond presenter name(s) removed for FERPA considerations Introduction Your programs will have

More information

Programming for the Web with PHP

Programming for the Web with PHP Aptech Ltd Version 1.0 Page 1 of 11 Table of Contents Aptech Ltd Version 1.0 Page 2 of 11 Abstraction Anonymous Class Apache Arithmetic Operators Array Array Identifier arsort Function Assignment Operators

More information