Java test

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which operator group has higher priority between (>, >=, <, <=) and (==, !=)?

(>, >=, <, <=) has higher priority (==, !=)

Range of byte is?

-128 to +127, including zero

Java source file extension is

.java

IF the ASCII code of character 'k' is 107, then what will be the ASCII code of character 'g'?

103

How many minimum number of operands are required to use Comparison operators in Java?

2

Java source file can have more than one class definition

True

What is the size of double in bits?

64

Java supports six relational operators that are used to make comparisons: =, <, >, <=, >=, =!

True

What is the size in bytes for a 'short' data type.

2

What is the size of float in bytes?

4

Identify the correct statement? double var1 = 125.0; double var2 = 2E+2; double var3 = 100e-2; double var4 = 0.01E3;

All are true

What is not an example of literals?

All options correct

Choose the correct statement about Java Operators +, -, *, / and %.

All the options - + and - have equal priority, / and % have equal priority, * and / have equal priority

An Arithmetic expression in Java involves which Operators or Operations?

All the options - Addition(+), Subtraction(-), Multiplication(*), Division(/), Modulo Division(%), Increment/Decrement(++/--), Unary Minus(-), Unary Plus(+)

What is the type of the value resulted from relational operator expression?

Boolean

In the following code lines print() and println() are System.out.print("JAVA"); System.out.println(" Programming");

Built in class method

JAVA compiler javac takes your source file as input file to be compiled and generates _____ file.

Bytecode file

_______ job is to ensure that bytecodes are valid and do not violate Java's security restrictions i.e.unauthorized access. This feature helps to prevent Java programs arriving over the network from damaging our system.

Bytecode verifier

One of the components of the JVM that takes the .class files containing the programs bytecodes and transfers them to RAM for execution is called as

Class loader

Java virtual machine interprets your bytecode to machine understandable code on the target CPU. It consists of three components to take care of this process.

Class loader, bytecode verifier, Just-in-time compiler

What is the other name for Relational Operators in Java?

Comparison operators and Conditional operators

Java source file is also called as

Compilation unit

The purpose of class keyword in Java source file is to

Define the class

Right Shift >> in Java is equivalent to?

Divide by 2

Which is not an integer data type?

Double

Advantages of C++ over C

Easy to learn Helps to manage growing code - extension ability Powerful Efficient Structured and object-oriented

Powerful features of C programming language are

Efficient Powerful Structured language Easy to learn

Drawback of C programming language

Extension ability of code is hard Not platform independent Complexity increases as program grows

Bytecodes are machine language binary codes

False

In Java source file main() method should be defined outside the class.

False

The access modifier, public keyword defines the visibility of the class member and that member can only be accessed within the class definitions of other members.

False

Bitwise operators in Java work with?

Individual bits of integers like byte, short, int, long, and char

If the range of the values for a certain information is 91345 to 121887, which integer data type should we use.

Int

Java edition used for developing large-scale, distributed networking applications and Web-based applications (server side-Java servlets and Java ServerPages)

J2EE

Java edition used for developing applications for small memory constrained devices, such as cell phones, pagers

J2ME

Java edition used for developing Desktop based applications and networking applications (client side-applets)

J2SE

Full form of J2ME

Java 2 Platform, Micro Edition

J2EE

Java 2, Platform, Enterprise Edition

J2SE

Java 2, Platform, Standard Edition

A boolean literal in Java can be type casted to which data type?

None of the options - byte, short, int

Problem with both C and C++ is

Not secure as JAVA Memory management is not automatic Platform dependent language

JAVA language was initially called as

Oak

Arithmetic operators +, -, /, * and % have which Associativity?

Left to right

Java program execution starts from

Main() method

Java program starts and ends with in

Main()method

In the following code lines dot ("." between System, out, and between out, print) is System.out.print("JAVA"); System.out.println(" Programming");

Member acces operator

Explicit Type Conversion in Java refers to ___?

Narrowing Type Conversion

Type Casting in Java usually refers to ____?

Narrowing Type Conversion

What is the result of a Widening Type Conversion in Java?

No change

In the following code lines out is System.out.print("JAVA"); System.out.println(" Programming");

Object

Original motivation for developing JAVA programming language was

Platform independent language

Between Postfix and Prefix arithmetic operators in Java, which operators have more priority?

Postfix operators have more priority than Prefix operators

Among Postfix Decrement and Prefix Increment operators in Java, which operator has less priority?

Prefix Increment has less priority than Postfix Decrement

What is this >>> bitwise operator in Java?

Right Shift Fill Zero operator

What is this >> bitwise operator in Java?

Right shift operator

In a lossy Type Casting or Type Conversion, how is the number truncated to the tager data type in Java?

That big number is Modulo Divided by the target data type highest possible number say 2^N and the remainder is taken

Innovation and development of new programming languages happens for two reasons:

To adapt to changing environment and uses To implement refinements and improvements in the art of programming

Bytecodes are independent of any particular microprocessor or hardware platform

True

Each bytecode instruction is translated into machine code at the time of execution

True

For class names we need to follow same rules for writing variable names and function names

True

If the source file contains more than one class then separate class files(bytecodes) will be generated for each class after the compilation.

True

In Java main class (class in which main() method is defined) name and source file name should be the same

True

In Java source file main() should be defined inside the class definition.

True

In Java, a source file should have at least one class and all code should reside inside the class.

True

Java Virtual Machine converts the bytecodes into machine codes that the underlying microprocessor understands

True

Java bytecode can be executed on any system that has the Java Virtual Machine (JVM) which is part of the JAVA Runtime Environment (JRE)

True

Java enables the creation of cross-platform programs by compiling into an intermediate representation called Java bytecode

True

Java is a strongly typed language

True

Java is an interpreted language

True

The access modifier, public keyword defines the visibility of the class member and that member can be accessed by code outside the class and within the class.

True

The same bytecodes can be executed on any platform containing a compatible JVM

True

static keyword allows to call a method/function without having a class instance or object;

True

Boolean values are:

True or False

Type promotion in Java usually refers to ___.

Widenening type conversion

Identify the correct statement about Boolean data types.

boolean is a valid keyword, where as bool is not a valid keyword

JAVA compiler javac takes your source file as input file to be compiled and generates ____ file.

class extension file with filename the same as class name Platform independent code Bytecode file

What are the types of data that can be used along with Relational operators in Java?

float, double, char, boolean, Object, byte, short, int, long

On the command prompt or terminal ________ is used to execute the bytecode (sourcefileName.class) generated after compilation and bytecode will be converted to target machine understandable.

java sourcefileName

If you are compiling a Java source file in the command prompt or terminal without using any IDE ______ command needs to be executed along with the source file name in the project folder.

javac sourcefileName.java

After the compilation of sourceFileName.java _________ will be created and it is known as ________

sourceFileName.class, bytecode


Ensembles d'études connexes

Bible Study Guide Hosea, Joel and Amos

View Set

AP Psych Chapter 4: States of Consciousness Multiple Choice, Unit 5 - States of Consciousness, Chapter 5 states of consciousness

View Set

Chapter#6- Closing Entries and the Postclosing Trial Balance

View Set

Sport & Physical Activity Related Injuries, Health Final

View Set

Unit 1 - Introduction to Entrepreneurship

View Set

NSCA CSCS chapter 13: warm up and stretching

View Set

Atomic Models and Properties of Atoms

View Set

Environmental Science Final - Study Guide

View Set

Chapter 12: Request for Comments

View Set