Q1 When formatting output you use Systemoutprintf T or F Q2
Q1. When formatting output, you use System.out.printf. (T or F)
Q2. To read in a value with a double data type, you use the nextDouble() method. (T or F)
Q3. When displaying the prompt that lets the user know what data to enter, it is best to use System.out.println. (T or F)
Q4. Before you can read in input, you need to create a Scanner object. (T or F)
Q5. To format an integer, you use \"%i\". (T or F)
Q6. To read input from the keyboard, you have to use the Scanner class. (T or F)
Q7. When formatting output with the printf method, you can only format one value in each printf method. (T or F)
Q8. You do not have to import the Scanner class. (T or F)
Solution
Q1. When formatting output, you use System.out.printf. (T or F)
Ans) True
We have to use System.out.printf(); statement if we want to format the output based on the requirement.like if we want to limit the output to two decimal places etc.
_________________________
Q2. To read in a value with a double data type, you use the nextDouble() method. (T or F)
Ans) True
Reason: We have to create the Scanner class object.On that object we have to call the nextDouble() method to read the double type value entered by the user.
_________________________
Q3. When displaying the prompt that lets the user know what data to enter, it is best to use System.out.println. (T or F)
Ans) True
Reason: we have to provide the information to the user regarding which type of data that user has to entered.That information we have to provide in System.out.println(); statement.Then user will have an idea about what type of data he has to enter.
_________________________
Q4. Before you can read in input, you need to create a Scanner object. (T or F)
Ans) True
Reason: Inorder to read the inputs entered by the user.Before that we have to create the Scanner class object.
Like Scanner sc=new Scanner(System.in);
__________________________
Q5. To format an integer, you use \"%i\". (T or F)
Ans) True
Reason :we can use either %i or %d to format the integer.
_________________________
Q6. To read input from the keyboard, you have to use the Scanner class. (T or F)
Ans) True
________________________
Q7. When formatting output with the printf method, you can only format one value in each printf method. (T or F)
Ans) Flase
Reason: we can format any number of values inside printf() method.
_________________________
Q8. You do not have to import the Scanner class. (T or F)
Ans) False
Reason: we have to import the scanner class.If we want to create the Scanner class object to read the inputs entered by the user.
import java.util.Scanner;
________________Thank You;

