Q3. the Class Streamtokenizer Is Used to Read Byte Data. True Or False?

Q3. the Class Streamtokenizer Is Used to Read Byte Data. True Or False?

<p> Review</p><p>Q1. Exceptions identify errors that arise in your program. Name the two categories of exceptions that are derived directly from Throwable and differentiate between them.</p><p>Q2 True or false. The classes InputStream and OutputStream are used to read and write byte data.</p><p>Q3. The class StreamTokenizer is used to read byte data. True or false?</p><p>Q.4 The classes Reader and Writer are used to read and write character data. True or false?</p><p>Q5 Write down the output as it would appear on the screen. class Exceptions { public static void main(String[] args) { int x[] = {2, 4, 6}; method(0, x); method(x[2], x); method(2, x); }</p><p> static void method(int i, int arr[]) { String str = "Yes its true"; try { System.out.println("Programming II"); System.out.println("This first value is " + arr[i]); System.out.println("This second value is " + arr[i]/(arr[i] - 6)); System.out.println("This line will be printed"); } catch(ArithmeticException e) { System.out.println("ArithemticException caught"); } catch(ArrayIndexOutOfBoundsException e) { System.out.println("ArrayIndexOutOfBoundsException caught"); } finally { System.out.println(str); } } 1 }</p><p>Q16 Given the following incomplete class definition, write appropriate Java code that will use the string str to create a file object. [1 mark]</p><p> class myFile { File f; myFile(String str) {</p><p>} }</p><p>Q7 Given the following method declaration, write appropriate code that will retrieve the number of bytes in the file.</p><p> int getBytes(File f) {</p><p>}</p><p>Q8 Given the following incomplete method, write appropriate Java code to that will use the string variable str to: (i) Create a BufferedReader object. </p><p>(ii) Use the BufferedReader object created in part (i) to read the file until it is empty. void readFile(String str) {</p><p>}</p><p>Q9 Use the concept of stack to convert the following infix expression to postfix expression. </p><p>5 * 2 + ( 14 – 12 ) – 10 * 6 The stack must be used to hold the operators and the left parentheses. The postfix string is used to hold the postfix string (the output). Show the state of the stack and the postfix string after each item is read from the infix string. The first two are done for you. The first four entries are done for you.</p><p>Question3 Use the concept of stack to evaluate the following postfix expression. Use the buckets below to show the state of the stack at each stage of the evaluation.</p><p>5 3 2 * + 4 - 5 +</p><p>2</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us