(a)
Florida International University COP3804 .
Question 1 What digits, and in what order, will they be printed when the following program is executed?
public class MyException
{
Static int k;
public static void main(String arg[])
{
try
{
int i = 5/k;
}
catch(ArithmeticException e)
{
System.out.println("1");
}
catch(RuntimeException e)
{
System.out.println("2");
}
catch(Exception e)
{
System.out.println("3");
}
finally
{
System.out.println("4");
}
System.out.println("5");
}
}
Question 2 Use the concept of stack to convert the following infix expression to postfix expression.
10 + ( 30 – 5 * 2 ) /5
Show the state of the stack and the state of the postfix string after each item is read from the infix string.
Question3
Use the concept of stack to evaluate the following postfix expression. Show the state of the stack after each item is read from the postfix string.
10 50 10 2 * - 6 / +
Question 6 Show the screen output from the program assuming that it runs without error.
(Place your answer to the right of the code)
import java.util.*;
public class Review
{
public static void main(String [] arg)
{
Vector myvec = new Vector(20);
Stack stack = new Stack();
for(int j=0,i=5; i ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- getting a loan to build a house
- what makes a man a man
- what makes a house a home
- a new way to buy a car
- make a resume for a job
- what is a theme of a story
- getting a loan to start a business
- is buying a house a good idea
- writing a will without a lawyer
- is a citation a charge
- is a citation a crime
- a reason a season a lifetime printable