Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

Tutorials

Java Server Pages

JAXB

Java Beans

JDBC

MySQL

Java Servlets

Struts

Bioinformatics

Java Code Examples

Interview Questions

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting

Linux

Beginner Guide to Linux Server

Frameworks

Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers

Softwares

Adware & Spyware Remover

Open Source Softwares

Quiz Questions
For Chapter 8


THIS PAGE CONTAINS A SAMPLE quiz on material from Chapter 8 of this on-line Java textbook. You should be able to answer these questions after studying that chapter. Sample answers to all the quiz questions can be found here.


Question 1: What does the computer do when it executes the following statement? Try to give as complete an answer as possible.

             Color[]  pallette  =  new  Color[12];

Question 2: What is meant by the basetype of an array?

Question 3: What does it mean to sort an array?

Question 4: What is meant by a dynamic array? What is the advantage of a dynamic array over a regular array?

Question 5: What is the purpose of the following subroutine? What is the meaning of the value that it returns, in terms of the value of its parameter?

      static String concat( String[] str ) {
         if (str == null)
            return null;
         String ans = "";
         for (int i = 0; i < str.length; i++) {
            ans = ans + str[i];
         return ans;
      }

Question 6: Show the exact output produced by the following code segment.

          char[][] pic = new char[6][6];
          for (int i = 0; i < 6; i++)
             for (int j = 0; j < 6; j++) {
                if ( i == j  ||  i == 0  ||  i == 5 )
                   pic[i][j] = '*';
                else
                   pic[i][j] = '.';
             }
          for (int i = 0; i < 6; i++) {
             for (int j = 0; j < 6; j++)
                System.out.print(pic[i][j]);
             System.out.println();
          }

Question 7: Write a complete subroutine that finds the largest value in an array of ints. The subroutine should have one parameter, which is an array of type int[]. The largest number in the array should be returned as the value of the subroutine.

Question 8: Suppose that temperature measurements were made on each day of 1999 in each of 100 cities. The measurements have been stored in an array

                int[][]  temps  =  new  int[100][365];

where temps[c][d] holds the measurement for city number c on the dth day of the year. Write a code segment that will print out the average temperature, over the course of the whole year, for each city. The average temperature for a city can be obtained by adding up all 365 measurements for that city and dividing the answer by 365.0.

Question 9: Suppose that a class, Employee, is defined as follows:

                class Employee {
                   String lastName;
                   String firstName;
                   double hourlyWage;
                   int yearsWithCompany;
                }

Suppose that data about 100 employees is already stored in an array:

                Employee[] employeeData = new Employee[100];

Write a code segment that will output the first name, last name, and hourly wage of each employee who has been with the company for 20 years or more.

Question 10: Suppose that A has been declared and initialized with the statement

double[] A = new double[20];

And suppose that A has already been filled with 20 values. Write a program segment that will find the average of all the non-zero numbers in the array. (The average is the sum of the numbers, divided by the number of numbers. Note that you will have to count the number of non-zero entries in the array.) Declare any variables that you use.


[ Answers | Chapter Index | Main Index ]

Useful Links
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.