Answered step by step
Verified Expert Solution
Question
1 Approved Answer
30. What is the value of x after the following statements? int x x=15 % 4; A. 0 B. 3 C. 3.75 D. 4 E.
30. What is the value of x after the following statements? int x x=15 % 4; A. 0 B. 3 C. 3.75 D. 4 E. 15 31. If you need to write a method that will compute the cost of some candy, where each piece costs 25 cents, which would be an appropriate method declaration? A. float CalculateCost (char name) B. float CaleulateCost (int countl) C. float CalculateCost int count D. char CalculateCost(int count) 32. What is wrong with the following switch statement? Scanner scan new Scanner (System. in) int ans system out.println(Type y for yes or n for non") ans scan.nextInt) switch (ans) case Y case TY system.out.print( "You said yes "); break case 'n' case N System.out.print( "You said noln") break default System.out.print( "Invalid answern") //End switch A. There are no break statements on two of the cases. B. ans is an integer data type C. Nothing D. break; is illegal syntax. 33. What are the valid indexes for the following array declaration? intiJ myArray new intl251: A. 0-24 B. 0-25 C. 1-24. D. 1-25 34. In a descending sort, which string would be first? A. "Wi11iam" B. "Mary" C. "1776" D. "Begin" E. "begin
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started