Header Ads

Top 20 Java Interview Questions | Top 20 Core Java Interview Question Series | Part 4

Top 20 Java Interview Questions  | Core Java Interview Question Series | Part 4

This is the fourth part of the Core Java interview questions Series in which we will dicuss next 20 Core java interview questions.  For the previous  60 Java interview questions Click Here: Core Java interview questions Part 1  Core Java interview questions Part 2  Core Java Interview questions Part 3. so let us start.

Top 20 Java interview question


Q.61). What is the default value of non-primitve data type?

Ans. Null is the default value of non-primitive data type

Q.62). What is datatype?

Ans. It is used to create a variable of a specific type. In Java data types are classified into two types 1). Primitive data types 2). Non-primitive data types

Q.63). What are the types of primitive data types?

Ans. Primitive data types are of 7 types 1). byte 2). short 3). int 4). long 5). float 6). double 7). char

Q.64). Why float is greater than long?

Ans. Float is greater than long, not based on capacity but on the memory mechanism

Q.65). What arenon-primitive non-primitive data types?

Ans. The datatypes which are used to create the non-primitive variable to store the reference is known as non primitive datatypes

Q.66). What is typecasting?

Ans. The process of converting one type of data into another type of data is known as type casting. It is of two types 1). Primitive type casting 2). Non-primitive type casting

Note: Software testing jobs service

We have started a Job Updates Service on WhatsApp and email. Those who wish to benefit from this service can subscribe. You will receive daily job updates via a PDF file.

Ping me for more information on 9050358180 .

Note: This is a paid service.

Q.67). What is primitive type casting?

Ans. The process of converting one primitive value into another primitive value is known as primitive type casting. It is of two types 1). Widening primitive type casting 2). Narrowing primitive type casting

Q.68). What is widening type casting?

Ans. 

  • The process of converting smaller range into large range data of primitive type is known as widening type casting.
  • In it, there is no data loss
  • Since there is no data loss, the compiler can do implicitly
  • It is also possible to do explicitly but not required
  • It is also called as implicit type-casting

Q.69). What is narrowing type casting?

Ans. 

  • The process of converting a larger range of primitive data into a smaller range of primitive data is known as narrowing type casting.
  • There may be a loss of data.
  • In it, data loss is there so the compiler does not narrow implicitly
  • It can be done explicitly by the programmer with the help of type cast operator.
  • It is also called as explicit type-casting

Q.70). What is a type cast operator?

Ans. It is a unary operator. Type cast operator is used to explicitly convert one data type into another data type

Q.71). What is the scope of the variable?

Ans. The visibility of the variable is known as the scope of the variable. It is of three types 1). Local variable 2). Static variable 3). Non-static variable

Q.72). What are the local variables?

Ans. The variable declared inside a method block or any other block except the class block is known as local variable.

Q.73). What are the characteristics of local variables?

Ans. 

  • We cannot use local variable without initialization, if we try to use without initialization then we will get compile time error.
  • Local variables are not initialized with default values
  • The scope of local variables is nested inside the block wherever it is declared hence it cannot used outside the class.

Q.74). What are the static variable?

Ans. The variable that is declared inside the class block with static keyword is known as static variable

Q.75). What are the characteristics of static variables?

Ans. 

  • It is assigned with default values
  • We can access it from anywhere, it has global accessibility ex. static int a

Q.76). What are the non-static variables?

Ans. The variable that is declared inside the class block without a static keyword is called non static variable

Q.77). What are the operators?

Ans. Operators are predefined symbols which is used to perform some specific task on the given data.

Q.78). What are the operands?

Ans. The data given as input to the operator is known as operand.

Q.79). What are the types of operators?

Ans. Operators are of three types 1). Unary operator 2). Binary operator 3). Ternary operator

Q.80). What are the types of operators based on the task?

Ans. 

  • Arithmetic operator 
  •  Assignment operator
  • Relational operator
  • Logical operator
  • Conditional operator 
  • Increment/decrement operator


Hope you like this article!

Please share this article with your friends and feel free to leave a comment in the comment section.

No comments

Powered by Blogger.