The BASE for JAVA LEARNING

by PRO FE S S OR


QUIZ for SECTION III

To find an answer, click on the desired question.


QUESTION 1:

Name 4 Primitive Data types.

QUESTION 2:

Non-primitive Data types are user defined and Java classes. Can you give an example of a Non-primitive Data type ?

QUESTION 3:

What is the keyword to make an identifier a constant ?

QUESTION 4:

What are the three kinds of Variables in JAVA ?

QUESTION 5:

True of False ? A local variable is declared outside the Method.

QUESTION 6:

What is the keyword to denote a class Variable ?

QUESTION 7:

In the following class definition, what should XXX be for displaying the class variable 'year' ? class Quiz
{ static int year;
public static void main(String[] args)
{ int year = 2002;
System.out.println( XXX );
}
}

QUESTION 8:

Write a class Quiz, containing a double as class variable, an int as Instance variable, a local char variable defined as 'A', and the 'main' method to display that local char variable.
























ANSWER to QUESTION 1:

Data primitive types are: char long int short byte boolean float double


Click your Back Button on your Browser to go back to the QUIZ Section.





















ANSWER to QUESTION 2:

A Non-primitive Data types: String


Click your Back Button on your Browser to go back to the QUIZ Section.





















ANSWER to QUESTION 3:

Keyword: final


Click your Back Button on your Browser to go back to the QUIZ Section.





















ANSWER to QUESTION 4:

Variables are: Local, Instance and class.


Click your Back Button on your Browser to go back to the QUIZ Section.





















ANSWER to QUESTION 5:

FALSE: Local Variables are always declared and defined in a method.


Click your Back Button on your Browser to go back to the QUIZ Section.





















ANSWER to QUESTION 6:

Keyword: static


Click your Back Button on your Browser to go back to the QUIZ Section.





















ANSWER to QUESTION 7:

Quiz.year

Writing 'year' displays '2002' as that's the local variable.


Click your Back Button on your Browser to go back to the QUIZ Section.





















ANSWER to QUESTION 8:

class Quiz
{ static double a;
int b;
public static void main(String[] args)
{ char c ='A';
System.out.println(c); // displays A
}
}


Click your Back Button on your Browser to go back to the QUIZ Section.





Click here to go to the JAVA Mini-Course page