Datatype in Java MCQs Exercise I

Ques 1 Datatype


Which of the following is not a Primitive datatype in Java?

A byte
B String
C float
D double

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

Ques 3 Datatype


What is the default initial value of boolean datatypes?

A true
B false
C 0
D 1

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