Deck 2: Introduction to Java Applications

ملء الشاشة (f)
exit full mode
سؤال
Which command compiles the Java source code file Welcome.java?

A)cd Welcome.java
B)javac Welcome.java
C)java Welcome.java
D)compile Welcome.java
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Which of the following is not a Java primitive type?

A)char
B)byte
C)real
D)double
سؤال
A(n)________ enables a program to read data from the user.

A)printf.
B)import declaration.
C)Scanner.
D)main.
سؤال
Which is the output of the following statements?
System.out.print( "Hello ");
System.out.println( "World" );

A)Hello World
B)HelloWorld
C)Hello
World
D)World
Hello
سؤال
End-of-line comments that should be ignored by the compiler are denoted using

A)Two forward slashes ( // ).
B)Three forward slashes ( /// ).
C)A slash and a star ( /* ).
D)A slash and two stars ( /** ).
سؤال
All import declarations must be placed

A)inside the class declaration's body.
B)before the class declaration.
C)after the class declaration.
D)all of the above will work.
سؤال
Which of the following escape sequences represents a carriage return?

A)\n.
B)\r.
C)\cr.
D)\c.
سؤال
When method printf requires multiple arguments,the arguments are separated with ________.

A)colons (:).
B)semicolons (;).
C)commas (,).
D)periods (. ).
سؤال
Which of the following is a variable declaration statement?

A)int total;
B)import java.util.Scanner;
C)public static void main( String args[] )
D)// first string entered by user
سؤال
Which of the following is not a valid Java identifier?

A)my Value
B)$_AAA1
C)width
D)m_x
سؤال
Which of the following cannot cause a syntax error to be reported by the Java compiler?

A)Mismatched {}
B)Missing */ in a comment that begins with /*
C)Missing ;
D)An extra blank line.
سؤال
Which of the following statement displays Hello World?

A)System.out.printf( "%2s","Hello " "World" );
B)System.out.printf( "%s %s","Hello","World" );
C)System.out.printf( "%s%s","Hello,World" );
D)System.out.printf( "s% s%","Hello","World" );
سؤال
Java's predefined classes are grouped into

A)packets.
B)declarations.
C)Galleries.
D)packages.
سؤال
The filename for the public class that begins with public class Addition must be

A)public.java.
B)public.class.java.
C)Addition.java.
D)addition.java.
سؤال
Which of the following statements would display the phase Java is fun?

A)System.out.println( "hellois fun\rJava " );
B)System.out.println( 'Java is fun' );
C)System.out.println( "\"Java is fun\"" );
D)System.out.println( Java is fun );
سؤال
Which of the following statements will print a single line containing
"hello there"?

A)System.out.println( "hello" );
System.out.println( " there" );
B)System.out.println( "hello" ," there" );
C)System.out.println( "hello" );
System.out.print( " there" );
D)System.out.print( "hello" );
System.out.println( " there" );
سؤال
Which of the following is the escape character?

A)*
B)\
C)\n
D)"
سؤال
Programs remember numbers and other data in the computer's memory and access that data through program elements called

A)comments.
B)messages.
C)integers.
D)variables.
سؤال
Which of the following does not contain a syntax error?

A)System.out.println( 'Hello world!' ):
B)System.out.println( "Hello
World!" );
C)System.out.println( "Hello world!" );
D)System.out.println( Hello world! );
سؤال
Which command executes the Java class file Welcome.class?

A)java welcome
B)java Welcome.class
C)java Welcome
D)run Welcome.class
سؤال
Which of the following statements is true?

A)System.out.print("Enter your age: ");prompts the user to take action.
B)Class names typically begin with a capital letter.
C)Package java.lang is imported in every Java program.
D)All of the above are true.
سؤال
Given the Java statement
Number1 = input.nextInt();
In which number1 is an int and input is a Scanner,which of the following occurs if the user does not enter a valid int value?

A)A compilation error occurs.
B)The program continues executing and assigns the value 0 to number1.
C)A runtime logic error occurs.
D)None of the above.
سؤال
Optional parentheses in expressions are said to be

A)redundant.
B)binary operators.
C)implied.
D)declared.
سؤال
Which of the following is not an arithmetic operator?

A)+
B)-
C).
D)%
سؤال
The format specifier ________ is a placeholder for an int value.

A)%n
B)%d
C)%int
D)%s
سؤال
Which of the following statements is false?

A)Primitive types are keywords.
B)Primitive types must appear in all lowercase letters.
C)Real numbers contain decimal points.
D)Variable name identifiers must begin with a lowercase letter.
سؤال
Which of the following statements does not alter the value stored in a memory location?

A)int a;
B)number = 12;
C)y = y + 2;
D)width = Integer.parseInt(input);
سؤال
Each of the following is a relational or equality operator except:

A)<=
B)=!
C)==
D)>
سؤال
Given the Java statement
Sum = number1 + number2;
Which of the following statements is false?

A)It's an assignment statement.
B)It calculates the sum of variables number1 and number2.
C)The operands of the addition operator are number1 and number2.
D)It assigns the value of number1 to sum.
سؤال
Which of the following is not a compilation error?

A)Neglecting to initialize a local variable in a method before it is used.
B)Placing a semicolon at the end of the first line of an if statement.
C)Omitting the left and right parenthesis for the condition of an if statement.
D)All are compilation errors.
سؤال
What will be output after the following Java statements have been executed (assume all variables are of type int)?
A = 4;
B = 12;
C = 37;
D = 51;
If ( a < b )
System.out.println( "a < b" );
If ( a > b )
System.out.println( "a > b" );
If ( d <= c )
System.out.println( "d <= c" );
If ( c != d )
System.out.println( "c != d" );

A)a < b
C != d
B)a < b
D <= c
C != d
C)a > b
C != d
D)a < b
C < d
A != b
سؤال
What is the value of result after the following Java statements execute (assume all variables are of type int)?
A = 4;
B = 12;
C = 37;
D = 51;
Result = d % a * c + a % b + a;

A)119
B)51
C)127
D)59
سؤال
Portions of statements that contain calculations are called

A)variables.
B)constants.
C)expressions.
D)None of the above.
سؤال
Which of the following is a Scanner method for inputting an integer value?

A)nextInteger
B)integer
C)nextInt
D)int
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/34
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 2: Introduction to Java Applications
1
Which command compiles the Java source code file Welcome.java?

A)cd Welcome.java
B)javac Welcome.java
C)java Welcome.java
D)compile Welcome.java
B
2
Which of the following is not a Java primitive type?

A)char
B)byte
C)real
D)double
C
3
A(n)________ enables a program to read data from the user.

A)printf.
B)import declaration.
C)Scanner.
D)main.
C
4
Which is the output of the following statements?
System.out.print( "Hello ");
System.out.println( "World" );

A)Hello World
B)HelloWorld
C)Hello
World
D)World
Hello
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
5
End-of-line comments that should be ignored by the compiler are denoted using

A)Two forward slashes ( // ).
B)Three forward slashes ( /// ).
C)A slash and a star ( /* ).
D)A slash and two stars ( /** ).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
6
All import declarations must be placed

A)inside the class declaration's body.
B)before the class declaration.
C)after the class declaration.
D)all of the above will work.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following escape sequences represents a carriage return?

A)\n.
B)\r.
C)\cr.
D)\c.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
8
When method printf requires multiple arguments,the arguments are separated with ________.

A)colons (:).
B)semicolons (;).
C)commas (,).
D)periods (. ).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following is a variable declaration statement?

A)int total;
B)import java.util.Scanner;
C)public static void main( String args[] )
D)// first string entered by user
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which of the following is not a valid Java identifier?

A)my Value
B)$_AAA1
C)width
D)m_x
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
11
Which of the following cannot cause a syntax error to be reported by the Java compiler?

A)Mismatched {}
B)Missing */ in a comment that begins with /*
C)Missing ;
D)An extra blank line.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which of the following statement displays Hello World?

A)System.out.printf( "%2s","Hello " "World" );
B)System.out.printf( "%s %s","Hello","World" );
C)System.out.printf( "%s%s","Hello,World" );
D)System.out.printf( "s% s%","Hello","World" );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
13
Java's predefined classes are grouped into

A)packets.
B)declarations.
C)Galleries.
D)packages.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
14
The filename for the public class that begins with public class Addition must be

A)public.java.
B)public.class.java.
C)Addition.java.
D)addition.java.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which of the following statements would display the phase Java is fun?

A)System.out.println( "hellois fun\rJava " );
B)System.out.println( 'Java is fun' );
C)System.out.println( "\"Java is fun\"" );
D)System.out.println( Java is fun );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
16
Which of the following statements will print a single line containing
"hello there"?

A)System.out.println( "hello" );
System.out.println( " there" );
B)System.out.println( "hello" ," there" );
C)System.out.println( "hello" );
System.out.print( " there" );
D)System.out.print( "hello" );
System.out.println( " there" );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which of the following is the escape character?

A)*
B)\
C)\n
D)"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
18
Programs remember numbers and other data in the computer's memory and access that data through program elements called

A)comments.
B)messages.
C)integers.
D)variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following does not contain a syntax error?

A)System.out.println( 'Hello world!' ):
B)System.out.println( "Hello
World!" );
C)System.out.println( "Hello world!" );
D)System.out.println( Hello world! );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
20
Which command executes the Java class file Welcome.class?

A)java welcome
B)java Welcome.class
C)java Welcome
D)run Welcome.class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following statements is true?

A)System.out.print("Enter your age: ");prompts the user to take action.
B)Class names typically begin with a capital letter.
C)Package java.lang is imported in every Java program.
D)All of the above are true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
22
Given the Java statement
Number1 = input.nextInt();
In which number1 is an int and input is a Scanner,which of the following occurs if the user does not enter a valid int value?

A)A compilation error occurs.
B)The program continues executing and assigns the value 0 to number1.
C)A runtime logic error occurs.
D)None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
23
Optional parentheses in expressions are said to be

A)redundant.
B)binary operators.
C)implied.
D)declared.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which of the following is not an arithmetic operator?

A)+
B)-
C).
D)%
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
25
The format specifier ________ is a placeholder for an int value.

A)%n
B)%d
C)%int
D)%s
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following statements is false?

A)Primitive types are keywords.
B)Primitive types must appear in all lowercase letters.
C)Real numbers contain decimal points.
D)Variable name identifiers must begin with a lowercase letter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which of the following statements does not alter the value stored in a memory location?

A)int a;
B)number = 12;
C)y = y + 2;
D)width = Integer.parseInt(input);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
28
Each of the following is a relational or equality operator except:

A)<=
B)=!
C)==
D)>
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
29
Given the Java statement
Sum = number1 + number2;
Which of the following statements is false?

A)It's an assignment statement.
B)It calculates the sum of variables number1 and number2.
C)The operands of the addition operator are number1 and number2.
D)It assigns the value of number1 to sum.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
30
Which of the following is not a compilation error?

A)Neglecting to initialize a local variable in a method before it is used.
B)Placing a semicolon at the end of the first line of an if statement.
C)Omitting the left and right parenthesis for the condition of an if statement.
D)All are compilation errors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
31
What will be output after the following Java statements have been executed (assume all variables are of type int)?
A = 4;
B = 12;
C = 37;
D = 51;
If ( a < b )
System.out.println( "a < b" );
If ( a > b )
System.out.println( "a > b" );
If ( d <= c )
System.out.println( "d <= c" );
If ( c != d )
System.out.println( "c != d" );

A)a < b
C != d
B)a < b
D <= c
C != d
C)a > b
C != d
D)a < b
C < d
A != b
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
32
What is the value of result after the following Java statements execute (assume all variables are of type int)?
A = 4;
B = 12;
C = 37;
D = 51;
Result = d % a * c + a % b + a;

A)119
B)51
C)127
D)59
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
33
Portions of statements that contain calculations are called

A)variables.
B)constants.
C)expressions.
D)None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
34
Which of the following is a Scanner method for inputting an integer value?

A)nextInteger
B)integer
C)nextInt
D)int
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 34 في هذه المجموعة.