Question
need help whats the answers

numItems and userVal are int types. What is the final value of numItems if userval=3? switch (userval) { case 1: numItems - 5
istall, isRich, and isFamous are Boolean variables. What is isFamous after executing the following statements? istall - false
Which expression results in true? Assume strl is Apples and str2 is apples. stri.equals(str2) str1.equals(apples) str2.
If userText is March 17, 2034, what does userText.indexOf(April) return? O-1
Convert this if-else statement to a single assignment statement using a conditional expression. if (x < 20){ Y-X) } else { y
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:12
explanation:
since userVal is 3
case 3 is executed
then numItems =12

Answer:false
explanation:
isTall is false and isRich is true
if condition fail, since both are not true
so, initially isFamous is false
hence final value of isFamous if false

Answer:str1.equals("Apples")
explanation:
it returns true because str1 and passed string both are same

Answer:-1
explanation:
since April is not present in userText
it returns -1

Answer:
y = (x<20)?x:20;

Add a comment
Know the answer?
Add Answer to:
need help whats the answers numItems and userVal are int types. What is the final value...
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
  • whats the answers What are the values of i for each iteration of: for (i =...

    whats the answers What are the values of i for each iteration of: for (i = 0; i < 6; ++i) { } 1 2 3 4 5 O 012345 0 0 1 2 3 4 5 6 1 2 3 4 5 6 For the following code, indicate how many times the loop body will execute for the following input values: 2 1 0? userNum = 3; while (userNum > 0) { // Do something // Get user Num...

  • QUESTION 1 What is the output of the following code snippet? int main() { bool attendance...

    QUESTION 1 What is the output of the following code snippet? int main() { bool attendance = false; string str = "Unknown"; attendance = !(attendance); if (!attendance) { str = "False"; } if (attendance) { attendance = false; } if (attendance) { str = "True"; } else { str = "Maybe"; } cout << str << endl; return 0; } False True Unknown Maybe QUESTION 2 What is the output of the following code snippet? #include <iostream> #include <string> using...

  • QUESTION 1 What will be displayed as a result of executing the following code? int   x...

    QUESTION 1 What will be displayed as a result of executing the following code? int   x = 5, y = 20; x += 32; y /= 4; cout <<"x = " << x <<"y = " << y; A. x = 32, y = 4 B. x = 9, y = 52 C. x = 37, y = 5 D. x = 160, y = 80 8 points    QUESTION 2 What will be the displayed when the following code...

  • Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C -...

    Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C - A consecutive group of memory chunks. D - None of the choices. Question 2 How many times is the body of the loop executed? int i=1; while(true) { cout << i; if(++i==5) break; } A - Forever B - 4 C - 5 D - 6 E - 0 Question 3 What is wrong with the following piece of...

  • what are the answers Which detects if x is in the range -4 to +4? (x...

    what are the answers Which detects if x is in the range -4 to +4? (x < -5) AND (* < 5) O (x >-5) AND (* < 5) O (X <-5) OR (x < 5) O (x > -5) OR (* < 5) If the final else branch executes, what must userNum have been? Type "unknown" if appropriate. if (userNum < 9) { > else if (userNum > 11) -- > else { ... // userNum if this executes...

  • QUESTION 7 Which of the following is a valid C++ assignment statement? (assume each letter is...

    QUESTION 7 Which of the following is a valid C++ assignment statement? (assume each letter is a different variable) A.y=b-c B.y +z = x C.x = a bi D.x = -(y*z): Ex = (x + (y z): QUESTION 8 Which of the following is a valid variable name according to C++ naming rules? A 2ndName B.%Last_Name C@Month D#55 Eyear03 QUESTION 9 Which library must be included to enable keyboard input? A kbdin B. cstdlib C input Diostream E lomanip QUESTION...

  • Please help to resolve my error. This Java code is supposed to evaluate one line equation...

    Please help to resolve my error. This Java code is supposed to evaluate one line equation of the form X Operator =Z where X is any name of a variable and Y and Z are integers By user in equation solver window. Currently the code executes expressions such as Y Operator(+,-,*,/) Z package Equations; /** * This program evaluates arithmetic expressions */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.StringTokenizer; public class EquationSolver extends JFrame implements ActionListener { private JTextField...

  • With a Scanner object created as follows, what method do you use to read an int...

    With a Scanner object created as follows, what method do you use to read an int value? Scanner input = new Scanner(System.in); A. input.int(); B. input.nextInt(); C. input.integer(); D. input.nextInteger(); What is the output of the following code? x = 0; if (x > 0) System.out.println("x is greater than 0"); else if (x < 0) System.out.println("x is less than 0"); else System.out.println("x equals 0"); A. x is greater than 0 B. x is less than 0 C. x equals 0...

  • Need help with C++ assignment Assignment 1 and .txt files are provided at the bottom. PART...

    Need help with C++ assignment Assignment 1 and .txt files are provided at the bottom. PART A PART B Assignment 1 #include <iostream> #include <string> #include <fstream> #include <iomanip> #include <stdio.h> #include <ctype.h> #include <string.h> #include <algorithm> using namespace std; /** This structure is to store the date and it has three integer fields **/ struct Date{    int day;    int month;    int year; }; /** This structure is to store the size of the box and it...

  • I need help finishing this excerise this is what I have:   I get this output for an error: RPS_ExerciseE1.rb:171:in `+&#...

    I need help finishing this excerise this is what I have:   I get this output for an error: RPS_ExerciseE1.rb:171:in `+': no implicit conversion of nil into String (TypeError) from RPS_ExerciseE1.rb:171:in `display_results' from RPS_ExerciseE1.rb:89:in `play_game' from RPS_ExerciseE1.rb:240:in `block in <main>' from RPS_ExerciseE1.rb:237:in `loop' from RPS_ExerciseE1.rb:237:in `<main>' Currently, the Game class’s get_player_move method uses a regular expression to validate the player’s moves of Rock, Paper, or Scissors, rejecting any input other than one of these words. Making the player enter entire words...

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