CIS 790 JavaScript QUIZ 1A

Last.First Name.email:
Johnston.Robert.rjohnston@aol.com

CIS 790 Java PROF. AUCIELLO

Explanation:

EXPLANATION:

This lesson-quiz represents some 'break-through' thinking: For example, we are working on the premise that the student is a committed and active 'participant' in the learning process; and work is migrating to the Web that can delivers instruction, provide 'forums', enable critical-thinking and and research, uses 'peer-learning' principles, and provides 'positive attendance' and highly interactive, participative environment that can function synchronously (real-time) or asynchronously (anytime, anywhere)!

Therefore, these quizzes are non-threatening. The rules are that you must respond to each question, and that you will compare and discuss your answers with other students or instructor, ("team learning") and keep re-taking the quiz until you feel that it is at the '100%' level. You will be graded on your last and best quiz.

To say it another way, I am using some Form-to-File Web Technology to give you Read and Write access to a shared file (virtual discussion group based on assigned topics).

Your IP address and date submitted are recorded along with your choices. Each time you submit, you can view the answers of others, and even print them out! You are expected to build on what you read, and do more thinking and research and submit responses in your own words. In other words, learn from what you read, and improve on it, and make it yours. Finally, at the end of the lesson, -- when you know that you understand it -- say "Mr. A. -- I got this lesson, thank you -- and type your name.

We will start now: it is meant to be an extension, an enhancement, a digital alternative to class instruction, a forum-group, an online seminar, and opportunity to improve on the High Performance Classroom concept.

Please add value, and earn extra points for improving the system.

            
          Say   "Multi-threading"!    While you are reading this quiz,
          keep another window open for "Java Help" from Sun, while
          you are checking your answers against an answer-database. 

"Prof. A, are you trying to get us to work "at-one" with the computer? Reading, thinking, writing, researching, and developing ourselves through some open windows of Knowledge?" (you ask).

"Yes. 15 points for the question. Exactly." "Could not have put it better myself!"

Become "at-one" with this marvelous technology and optimize your skills! "Power user." Use the web as we once used books, now strengthened with quick links to other points of view, and ability to test ideas, compile and run, thoughts into programs and applets! Go for it! Use the technology to its limit. Push the edge. Show me what you can do! And "add value" to this 'electronic learning community' concept by developing "high quality answers" so that others may springboard ahead.

At the end of the lesson - when you know that you understand it - say "Mr. A., I got 'it' Thank You!" - and type your name, again.

(J. Auciello. Feb 16, 2002. from my office at home.)

Use the web for your answers:

For example:

    http://www.javascriptkit.com/javatutors/string4.shtml

    explains the 'charAt' statement. (Use JavaScript to

    understand Java -- JS is the 'light" version of Java.)

Here is a copy of kb21.java (Unicode Conversions)


   /*  CIS 790        kb21.java          PROF.  AUCIELLO
    type conversions.
    converting strings to chars to integers.
    do { } while (condition)
  */

class kb21  
  { public static void main(String args[])
      { byte buff2[] = new byte[64];
        byte buffer[] = new byte[2056];
        char c;
        int  cdec;
        String charin;
        try
         {  
         do { 
             //  NOTE.  THIS METHOD READS ENTIRE STRING INC.  LF  & CR.
             // 1st try:
             System.out.print  ("Enter Single Character (/ to exit) ");
             System.in.read(buff2, 0, 64);
             String str5 = new String(buff2,0);
             // System.out.println("Untrimmed Length of " + str5 + " = " + str5.length());
             String str6 = str5.trim();
             // System.out.println("Trimmed Length of " + str6 + " = " + str6.length());
             c           = str6.charAt(0);
             cdec        = (int) c;
             System.out.println(c + " = " + cdec);
             
 
             //System.out.print("Type a Single Character ");
             //c         = (char)System.in.read();
             //cdec  = (int) c;
             //System.out.println(c  + " = "  cded);
            } // ends do
         while (cdec != 47);

         } // ends try

        catch (Exception e)
           { String err = e.toString();
             System.out.println(err);
           } // end try-catch.

      } // end main procedure.
  } // end class 

Q001: What are the (2) ways to make comments in Java? What is the difference? How did you find out -- any answer here is correct. (I want to know how you learn.)

 

Q002:

       What is the relationship between the "internal java name"
       and the external name of the java program?
       Are they case-sensitive?


Q003: This one is given.


{ public static void main(String args[])
    !      !      !   !     ! -- "String args[] = array of String type
    !      !      !   !     ! -- enables passing a string argument to
    !      !      !   !     ! -- to the program.                               
    !      !      !   ! -- "main" = main method (procedure)             
    !      !      ! -- "void" = does not return a result.
    !      ! -- "main" method must be "static" (unchanging) &
    !      ! --  exist before objects in class are created.
    ! -- "public access modifier" = program variables and methods
    ! -- are available publicly, inside & outside of the class (program).
    ! -- "globally visible and accessible" by any other object!                                                        
    
Another helpful link:
http://www.ergoit.co.uk/main/WhatWhy.html


Q004:
      Explain these statements:

   1     byte buff2[] = new byte[64];
   2     byte buffer[] = new byte[2056];
   3     char c;
   4     int  cdec;
   5     String charin;

   1 -- a new instance of the class object "buff2" is created
        with 64 bytes in length.
   (continue with statements 2 - 5)     


Q005:

  Explain every line:

        try
         {
         do { 
             //  NOTE.  THIS METHOD READS ENTIRE STRING INC.  LF  & CR.
             // 1st try:
             System.out.print  ("Enter Single Character (/ to exit) ");
             System.in.read(buff2, 0, 64);
             String str5 = new String(buff2,0);
             // System.out.println("Untrimmed Length of " + str5 + " = " + str5.length());
             String str6 = str5.trim();
             // System.out.println("Trimmed Length of " + str6 + " = " + str6.length());
             c           = str6.charAt(0);
             cdec        = (int) c;
             System.out.println(c + " = " + cdec);
                                     


Q006:

  EXPLAIN THIS DO ... WHILE LOOP. 

          do {    }                     
          while (cdec != 47);


Q007:
   Explain the following lines:
          
        catch (Exception e)
           { String err = e.toString();
             System.out.println(err);
           } // end try-catch.


      } // end main procedure.
  } // end class