Datatype in Java Exercise I


Ques 1 Datatype


Which of the following is not a Primitive datatype in Java?
  a) byte
  b) String
  c) float
  d) double


b is the correct option




Ques 2 Datatype


Ashish is writing a class to handle student details. It requires two important variables student_name and student_mobileNumber. For name, he has taken that datatype as String. For student_MobileNumber what should be the data type?
  a) short
  b) float
  c) char
  d) long


d is the correct option




Ques 3 Datatype


What is the default initial value of boolean datatypes?
  a) true
  b) false
  c) 0
  d) 1


b is the correct option




Ques 4 Datatype


Consider the following code,


class student
{
      int studName;
       public void NewStudent(int studentid,String StudentName)
      {
             String studName;
             studName=StudentName;  //Line 1
      }
}
In Line 1. What is the scope of the variable "studName" ?
  a) Local
  b) Global
  c) Class
  d) Instance


a is the correct option