Q01 - Intro

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

javac Test.java

The JDK command to compile (not run) a class in the file Test.java is A. java Test B. java Test.java C. javac Test.java D. javac Test E. JAVAC Test.java

public static void main(String[] args)

The main method header is written as: A. public static void main(string[] args) B. public static void Main(String[] args) C. public static void main(String[] args) D. public static main(String[] args) E. public void main(String[] args)

.class

The extension name of a Java bytecode file is ___________. A. .java B. .obj C. .class D. .exe

receives a compile error

When assigning a literal to a variable of the byte type, if the literal is too large to be stored as a byte value, it ___________. A. causes overflow B. causes underflow C. causes no error D. cannot happen in Java E. receives a compile error

java ByteCode

Which JDK command is correct to run a Java application in Bytecode.class? A. java ByteCode B. java ByteCode.class C. javac ByteCode.java D. javac ByteCode E. JAVAC ByteCode

None of the above

Which of the following are examples of invalid string literals? A. "Hello World" B. "Yeet Dat Boiiii" C. "K" D. "" E. None of the above

All

Which of the following are the reserved words? A. public B. static C. void D. class

(int) ( 45.378 * 100 ) / 100.0

Which of the following expressions results in 45.37? A. (int) ( 45.378 * 100 ) / 100 B. (int) ( 45.378 * 100 ) / 100.0 C. (int)( 45.378 * 100 / 100 ) D. (int) ( 45.378 ) * 100 / 100.0

int years = 1; months = 12; days = 365;

Which of the following is an example of an invalid assignment or declaration statement? A. int age = 30; B. int money, dollars = 0, cents = 0; C. int years = 1; months = 12; days = 365; D. int length, meters, centimetres, millimetres, E. none of the above

result = ((19 + 4) - 5;

Which of the following is an example of an invalid expression in Java? A. result = a + b; B. result = (14+ 9) * 5; C. result = ((19 + 4) - 5; D. result = firstNum/secondNum % thirdNum

2ndlevel

Which of the following is not a valid Java identifier? A. answer_7 B. highest$ C. anExtremelyLongIdentifierIfYouAskMe D. 2ndlevel E. thirdNumber

Compilation. 4 OOP concepts in Java include the first 3 and Abstraction.

Which of the following is not an OOP concept in Java? A. Inheritance B. Encapsulation C. Polymorphism D. Compilation

These are all arithmetic operations in Java

Which of the following is not an arithmetic operation in Java? A. + B. / C. - D. % E. These are all arithmetic operations in Java

// xxx and /* xxx */

Which of the following lines is a properly formatted comment? A. // This is a comment B. /* This is a comment */ C. # This is a comment D. # This is a comment\n

System.out.println("Welcome To Java");

Which of the following statements is correct to display Welcome to Java on the console? A. System.out.println('Welcome To Java'); B. System.out.println("Welcome To Java"); C. System.println('Welcome To Java'); D. System.out.println('Welcome To Java"); E. System.out.println("Welcome To Java');

Every statement in a program must end with a semicolon.

Which of the following statements is correct? A. Every line in a program must end with a semicolon. B. Every statement in a program must end with a semicolon. C. Every comment line in a program must end with a semicolon. D. Every method must end with a semicolon. E. Every class must end with a semicolon.

dividing by zero

Which of the following will be considered a logical error? A. forgetting a semicolon at the end of a programming statement B. typing a curly bracket when you should have typed a parentheses C. multiplying two numbers when you meant to add them D. dividing by zero E. misspelling an identifier

new

Which of these operators is used to allocate memory to array variable in Java? A. alloc B. malloc C. new malloc D. new

Java

_______ is architecture-neutral. A. Java B. C++ C. C D. Ada E. Pascal

Java JDK

___________ consists of a set of separate programs for developing and testing Java programs each of which is in okey from a command line. A. Java language specification B. Java API C. Java JDK D. Java IDE

Java API

___________ consists predefined classes and interfaces for developing Java programs. A. Java language specification B. Java API C. Java JDK D. Java IDE

Java virtual machine

___________ is a software that interprets Java bytecode. A. Java virtual machine B. Java compiler C. Java debugger D. Java API

A class

___________ is a template that defines objects of the same type. A. An object B. A class C. A method D. A data field

An object

___________ represents an entity in the real world that can be distinctly identified. A. An object B. A class C. A method D. A data field

Char and Byte

switch( i ) { default: System.out.printIn ("hehe"); } What are the two acceptable data types for the variable i? A. char B. byte C. float D. double E. object

parentheses

A block is enclosed inside ___________. A. parentheses B. braces C. brackets D. quotes

compile-time error

A syntax error is a ___________. A. logical error B. compile-time error C. run-time error D. bug E. exception

class

An object is an instance of a ___________. A. program B. class C. method D. data

10, initial or default capacity of an array without any quantity being specified is 10 - can hold ten (10) values.

ArrayList list = new ArrayList(); What is the initial quantity of the ArrayList list? A. 5 B. 10 C. 0 D. 0

boolean

Data type that allows only one of two possible values to be assigned: A. char B. int C. boolean D. float E. long

bytecode

Java compiler translates Java source code into _________. A. bytecode B. machine code C. assembly code D. an object-oriented language

integers, floating points

Java has two basic kinds of numeric values: ___________, which have no fractional part, and ___________ which do. A. shorts, longs B. doubles, floating points C. characters, bytes D. integers, floating points E. integers, longs

Test.java

Suppose you define a Java class as follows, the source code should be stored in a file named ___________. public class Test { .... } A. Test.class B. Test.doc C. Test.txt D. Test.java


Ensembles d'études connexes

Chapter 42 (Psychosocial Disorders)

View Set

A.D Banker - Life Insurance Prep - Chapter 11

View Set

earth science: chapter 25 part 1

View Set

Introduction to programming using python--Hello World chapt. 7,8,9,11,12,13

View Set

AP1 Ch. 10 Muscle Tissue Physiology

View Set

Chapter 14: Multirisk Management Contracts: Auto

View Set

Abdominal 3, Prostate/***** Anatomy and Physiology

View Set