Question

QUESTION 1 If an exception is thrown None listed all listed execution terminates if there is...

QUESTION 1

  1. If an exception is thrown

    None listed

    all listed

    execution terminates if there is no catch block handling the same data type as the exception thrown

    execution continues if the catch block handles the same data type as the exception thrown

10 points   

QUESTION 2

  1. An exception is handled using

    an if-else statement

    an assignment statement

    a loop statement

    a try-catch block

10 points   

QUESTION 3

  1. In program 9.4, what is the data type being thrown?

    int

    ifstream

    ofstream

    string

10 points   

QUESTION 4

  1. A throw block is where

    a catch takes place

    an exception is handled

    where execution continues after an exception

    an exception may be thrown

10 points   

QUESTION 5

  1. For two strings defined and initilized as:

    string string1 = "Hello";
    string string2 = "Hello there";

    Which operation returns true?

    string1 <= string2

    string1 < string2

    string1 == string2

    string1 < string2

10 points   

QUESTION 6

  1. Which function returns a double data type?

    cin.get();

    itoa()

    atoi()

    atof()

10 points   

QUESTION 7

  1. Which statement can collect a string containing spaces from the keyboard?

    Provided

    string strObj;

    cout << strObj + "space";

    strObj.c_str();

    cin >> strObj;

    getline(cin, strObj);

10 points   

QUESTION 8

  1. A string function that returns a character at a specified index is

    find()

    c_str()

    at()

    size()

10 points   

QUESTION 9

  1. If strObj is defined as:

    string strObj = "This cannot be";

    which statement results in strObj of length 21 characters?

    strObj += " correct";

    strObj.find("be");

    strObj.replace(12, 6, "to");

    strObj.insert(4, " I know");

10 points   

QUESTION 10

  1. A string function that returns a boolean value is

    compare()

    at()

    find()

    empty()

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

1)  all listed
2)  a try-catch block
3)  9.4 is required to answer this.
4)  an exception may be thrown
5)  string1 < string2
6)  atof()
7)  getline(cin, strObj);
8)  at()
9)  strObj.insert(4, " I know");
10) empty()
Add a comment
Know the answer?
Add Answer to:
QUESTION 1 If an exception is thrown None listed all listed execution terminates if there is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • absolute C++ QUESTION 1 Which statement is incorrect? When an event occurs that cannot be managed...

    absolute C++ QUESTION 1 Which statement is incorrect? When an event occurs that cannot be managed locally, an exception may be thrown. Throwing the exception object transfers control and information gleaned locally to some calling program unit that manages the event, or the program terminates If an exception is thrown in a function, sayf, but not handled there, the exception is propagated to the function that called fo In C++, an exception object can be a user-defined type or any...

  • Question 1 (5 points) Question 1 Unsaved What is displayed on the console when running the...

    Question 1 (5 points) Question 1 Unsaved What is displayed on the console when running the following program? public class Quiz2B { public static void main(String[] args) { try { System.out.println("Welcome to Java"); int i = 0; int y = 2 / i; System.out.println("Welcome to Java"); } catch (RuntimeException ex) { System.out.println("Welcome to Java"); } finally { System.out.println("End of the block"); } } } Question 1 options: The program displays Welcome to Java two times. The program displays Welcome to...

  • Question 10 (3 points) Which of the following statement is not true? There is a recursive...

    Question 10 (3 points) Which of the following statement is not true? There is a recursive sum method as shown below. When sum (19) is called, summation of all odd numbers less than 19 will be calculated and returned public int sum(int x){ if (x == 0) return 0: else return sum(x-2) + x; The following code segment will throw a testException. This exception has been handled in the way that do nothing but to continue when this exception happens....

  • Write the C# code and make a screenshot of the output according to tasks given below:...

    Write the C# code and make a screenshot of the output according to tasks given below: Create a class named Prism with protected data fields named height and volume (Use double data type for the fields) [5 points] Include public properties for each field. The Height and Volume properties should have get and set accessors. [5 points] Add default constructor which sets the value of Height and Volume properties to 1 and 1 respectively. [5 points] Add overloading constructor which...

  • Chapter 08 Python Assignment: Question 1-5 Please I need help in my python course. Question 1...

    Chapter 08 Python Assignment: Question 1-5 Please I need help in my python course. Question 1 The finally clause of a try statement a. can be used to recover from an exception b. is required c. can be used to display more information about an exception d. is executed whether or not an exception has been thrown 10 points Question 2 Which of the following is the correct way to code a try statement that catches any type of exception...

  • Python3 please use while loop to solve this question,specific information is on the graph Question 2...

    Python3 please use while loop to solve this question,specific information is on the graph Question 2 - 15 marks Write the function read_file_center50 (filename). The function returns a list of 50 strings that are at the center of the file. A file has n lines, then is the center. A list of length 50 is returned, where the first line is 25 and the last line is 2 + 25. If the file has n < 50 lines, then only...

  • Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal...

    Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal '2', a string literal "2", and the numeric literal 2 are identical and stored the same way though they are different types. 3 Since comments do not affect the program execution, you don't need to have it at all. 4. After the following statements are executed, the value of the variable rem is 3. 1. A preprocessor directive line starts with a pound sign...

  • In this assignment you are going to handle some basic input operations including validation and manipulation,...

    In this assignment you are going to handle some basic input operations including validation and manipulation, and then some output operations to take some data and format it in a way that's presentable (i.e. readable to human eyes). Functions that you will need to use: getline(istream&, string&) This function allows you to get input for strings, including spaces. It reads characters up to a newline character (for user input, this would be when the "enter" key is pressed). The first...

  • True False Question 2 (3 points) Given a singly linked list with more than two nodes,...

    True False Question 2 (3 points) Given a singly linked list with more than two nodes, to remove the second node from a linked list with only head reference, assume curr - head, next, you do Set curr.next to head.next Oset head. next to curr.next Set head, next to curr Oset head to curr.next TL th Question 3 (3 points) Given the following singly linked list (a list with four nodes), what will be the value stored at the last...

  • Comments used to document code should: A. be used as little as possible B. be insightful...

    Comments used to document code should: A. be used as little as possible B. be insightful and explain what the instruction's intention is C. only be included in code that is difficult to understand D. be used to define variables whose names are not easy to understand E. not be included with the program 2 points    QUESTION 2 The main method for a Java program is defined by: A. public static main( ) B. public static main(String[ ] args);...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT