Question
Please answer both questions thank you.
Question 5 (1 point) Consider a file called input.txt that has the following 4 lines: Trace the program I when it is 89 lines
Question 7 (1 point) Assume that n is 8 and k is 5. Which of the Boolean expressions are true? 8 < n && n < k 11 k < 10 n >=
0 0
Add a comment Improve this question Transcribed image text
Answer #1

5)

Output - 13

in.next() reads every string and store it in value at every iteration. The input.txt file has 13 strings and hence count = 13

7)

Output - 1,2,4,5

1) False && False || True => False || True => True

2) True && True => True

3) !(True) => False

4) !(True && False) => !(False) => True

5) True || False => True

6) Compilation Error in code if its in java

otherwise 0<=k<n => 0<=k && k<n => True && True=> True

Add a comment
Know the answer?
Add Answer to:
Please answer both questions thank you. Question 5 (1 point) Consider a file called input.txt that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 15 (1 point) What does this program print? Please make sure your spacing is exact....

    Question 15 (1 point) What does this program print? Please make sure your spacing is exact. public class Test { System.out.print("39 + 3"); System.out.println(39 + 3); } 1 A/ Question 5 (1 point) Consider a file called input.txt that has the following 4 lines: Trace the program when it is 89 lines 78.5 is average. Isn't it? What would be the value of count after the following code snippet executes? Scanner in = new Scanner (new File("input.txt")); int count 0;...

  • Please answer both questions thank you. Assuming that a user enters 8, 15, and 11 as...

    Please answer both questions thank you. Assuming that a user enters 8, 15, and 11 as input values one after another, separated by spaces, what is the output of the following code snippet? int num1 = 0; int num2 = 0; int num3 = 0; Scanner in = new Scanner (System.in); System.out.print("Enter a number: "); numl - in.nextInt(); System.out.print("Enter a number: "); num2 = in.nextInt(); System.out.print("Enter a number: "); num3 = in.nextInt(); if (numl > num2) if (numl > num3)...

  • Please answer both questions. Thanks Question 26 (1 point) What is the output generated by the...

    Please answer both questions. Thanks Question 26 (1 point) What is the output generated by the code segment below, assuming that data is a Scanner object used to read the following text: As the world turns. data.useDelimiter(" "); int count = 0; while (data.hasNext()) { char input data.next().charAt(0); if (! Character.isLetter (input)) { count++; System.out.println (count); A/ Question 27 (1 point) Assuming that the user provides 114 as input, what is the output of the following code snippet? Please make...

  • Please answer both questions thank you. Question 52 (1 point) What is the output of the...

    Please answer both questions thank you. Question 52 (1 point) What is the output of the code snippet given below? String s = "abcde"; int i = 1; while (i < 5) { System.out.print(s.substring(i, i + 1)); i++; Question 50 (1 point) How many times will the output line be printed in the following code snippet? Please enter your answer as an integer. for (int i = 0; i < 3; i++) { for (int j = 1; j <...

  • Please answer both questions thank you. Question 49 (1 point) What is wrong with the following...

    Please answer both questions thank you. Question 49 (1 point) What is wrong with the following code snippet? for (int i 1; i <= 5; i++) { int squared = i + i; System.out.println(i + IT "! squared = + squared); } System.out.println("Last square = " + squared); calculation error variable scope error O nothing incorrect use of for loop Question 47 (1 point) What are the values of num1 and num2 and result after the execution of mystery (num1,...

  • Please answer both questions thank you. Question 39 (1 point) Translate the following conditions to Java,...

    Please answer both questions thank you. Question 39 (1 point) Translate the following conditions to Java, where x is an integer and s is a string. 1. x >= 6 2. x < 0 s is "Day" 3. S = "Day" x is at least 6 4. X == -7 DODO x is at most 6 5. x = -7 x is - 7 6. s.equals("Day") 7. x <= 6 x is not 27 8. X >O x is positive...

  • Please answer correctly & fast. This is a test grade. Thank you! Question 60 (1 point)...

    Please answer correctly & fast. This is a test grade. Thank you! Question 60 (1 point) Where n = 7192 , the expression n % 100 would return O2 O 92 o 071 o Question 57 (1 point) In JavaFX, the window. class allows a picture to be incorporated into your Graphic Color Picture ImageView Question 56 (1 point) To signal an exception could occur, use the reserved word. throws pitches swings tosses Question 55 (1 point) What does this...

  • please please answer both questions . Thank you !!! Question 9 (1 point) Benzene and toluene...

    please please answer both questions . Thank you !!! Question 9 (1 point) Benzene and toluene form an ideal solution. At 298 K, what is the mole fraction of benzene in the liquid that is in equilibrium with a vapor that has equal partial pressures of benzene and toluene? At 298 K, the vapor pressures of pure benzene and pure toluene are 95 and 28 tor respectively 0.50 0.77 0.23 0.30 none of these Question 10(1 point) 340.0 g of...

  • Please answer both questions. Thanks Question 24 (1 point) What value would be returned if the...

    Please answer both questions. Thanks Question 24 (1 point) What value would be returned if the method mystery were called and passed the array values (1, 15, 37, 12) as its parameter? public static int mystery (int[] list) int x = 0; for (int i = 1; i < list.length; i++) { int y = list[i] - list [0]; if (y > x) x = Y } } return x; 29 35 1 36 Question 25 (1 point) What is...

  • please answer all the questions. thank you. Question 1 (1 point) Saved When an inductive argument...

    please answer all the questions. thank you. Question 1 (1 point) Saved When an inductive argument is based on strong evidence, it is called a... true argument syllogistic argument O random argument O cogent argument Question 2 (1 point) Saved Control and experimental groups do not have to be representative of targeted populations in order to provide sufficient research for statistical generalizations. 1) True 2) False Question 3 (1 point) ✓ Saved A sample is biased when o the researcher...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT