Quizzes
Search
Take Quizzes
Animal
Nutrition
Love
Relationship
Computer
Sports
Society
Business
Geography
Language
Personality
Harry Potter
Movie
Television
Music
Online Exam
Health
Country
Art
Entertainment
Celebrity
Math
Game
Book
Fun
Science
Food
History
Education
All Topics
Create a Quiz
Quiz Maker
Training Maker
Survey Maker
Flashcards
Brain Games
See All
ProProfs.com
Search
Create A Quiz
Take Quizzes
Animal
Nutrition
Love
Relationship
Computer
Sports
Society
Business
Geography
Language
Personality
Harry Potter
Movie
Television
Music
Online Exam
Health
Country
Art
Entertainment
Celebrity
Math
Game
Book
Fun
Science
Food
History
Education
All Topics
Products
Quiz Maker
Training Maker
Survey Maker
Flashcards
Brain Games
See All
ProProfs.com
Quizzes
Quizzes
›
Computer
Java Programming 2
10 Questions
|
By Marlenegalea | Updated: Mar 15, 2022
| Attempts: 240
Share
Start
Share on Facebook
Share on Twitter
Share on Whatsapp
Share on Pinterest
Share on Email
Copy to Clipboard
Embed on your website
Question
1
/ 10
0 %
0/100
Score
0/100
1.
Which of the following outputs 'I love Java' on the screen?
String IloveJava;
System.out.println ("I love Java");
IloveJava = input.nextLine;
Submit
Start Quiz
About This Quiz
2.
What's your name?
We’ll put your name on your report, certificate, and leaderboard.
2.
How would you declare a variable that will hold a single word and is called 'name'? In the same line place the value 'Jane' in this variable.
String name = "Jane";
Jane = name;
"Jane" = name;
Submit
3.
Which of the following creates and assigns an array of 10 marks that will hold whole numbers only?
String[] markList = new String[10];
Int[] markList = new int[10];
Int[10] = markList;
Submit
4.
Consider the loop below: for (i = 1; i < 11; i++){ System.out.println ("The counter is now reading " + i); }
This loop outputs the numbers 1 to 10
This loop outputs the numbers 1 to 11
This loop outputs the numbers 2 to 10
Submit
5.
A programmer has imported the Scanner class into his class and created an object of Scanner called 'input'. Which of the following reads keyboard input and places it into the integer variable 'length'?
Length = input.nextInt();
Length = Scannerinput;
Input.nextInt.length;
Submit
6.
The class
Shape
has a method called 'findArea'. shape1 is an object of class
Shape
. Which of the following lines calls the method findArea for the object shape1?
Shape1.findArea();
Shape1.Shape.findArea;
Shape.findArea();
Submit
7.
How would you declare a variable that will hold a whole number and is called 'mark'?
String mark;
Double mark;
Int mark;
Submit
8.
What is the function of the following line? System.out.println (sqrt(x));
The method sqrt in the Math class is called and so the square of x is output.
The method sqrt in the Math class is called and so the square root of x is output.
The method sqrt in the Math class is called and so the double of x is output.
Submit
9.
An array called markList holds ten marks. Which is the correct code for outputting those marks on the screen?
For ( i = 0; i
For ( i = 0; i
For ( i = 1; i
Submit
10.
The Math class can be made available to our class by importing it using the line:
Import static java.Math.*;
Import java.lang.Math.*;
Import static java.lang.Math.*;
Submit
View My Results
Related Quizzes
Tablet Quiz: What Tablet Should I Buy Quiz
Tablet Quiz: What Tablet Should I Buy Quiz
Thank you for your feedback!
Would you like to edit this question to improve it?
No thanks
Name:
Email:
Oops! Give us more information:
Incorrect Question
Incorrect Answer
Typos
I have a feedback
Submit
Please provide name and email to proceed.
Please provide correct email to proceed.
Please provide feedback.
Please select the option.
All (10)
Unanswered (
)
Answered (
)
Which of the following outputs 'I love Java' on the screen?
How would you declare a variable that will hold a single word and is...
Which of the following creates and assigns an array of 10 marks that...
Consider the loop below:...
A programmer has imported the Scanner class into his class and created...
The class Shape has a method called 'findArea'. shape1...
How would you declare a variable that will hold a whole number and is...
What is the function of the following line?...
An array called markList holds ten marks. Which is the correct...
The Math class can be made available to our class by importing it...
X
OK
X
OK
Cancel
X
OK
Cancel
Back to top
Back to top
Advertisement