1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Firlakuza [10]
3 years ago
11

Trace the evaluation of the following expressions, and give their resulting values. Make sure to give a value of the appropriate

type (such as including a .0 at the end of a double or quotes around a String).
4 + 1 + 9 + "." + (-3 + 10) + 11 / 3
8 + 6 * -2 + 4 + "0" + (2 + 5)
1 + 1 + "8 - 2" + (8 - 2) + 1 + 1
5 + 2 + "(1 + 1)" + 4 + 2 * 3
"1" + 2 + 3 + "4" + 5 * 6 + "7" + (8 + 9)
Computers and Technology
1 answer:
Masja [62]3 years ago
7 0

Answer:

(a)\ 14"."43

(b)\ 0"0"7

(c)\ 2"8 - 2"611

(d)\ 7"(1 + 1)"46

(e)\ "1"23"4"30"7"17

Explanation:

Required

Evaluate each expression

The simple rules to follow are:

(1) All expressions in bracket will be evaluated based on its data type

(2) Divisions will return only integer values

(3) Integers immediately after string values will be concatenated (not added)

So, the results are as follows:

(a)\ 4 + 1 + 9 + "." + (-3 + 10) + 11 / 3

Evaluate till a string is encountered

4 + 1 + 9 = 14

Followed by "."

Then:

(-3 + 10)   = 7

11/ 3 = 3

"." + (-3 + 10) + 11/3 = "."73 -- because expressions after string operations are concatenated.

So, we have:

4 + 1 + 9 + "." + (-3 + 10) + 11 / 3 = 14"."43

(b)\ 8 + 6 * -2 + 4 + "0" + (2 + 5)

Evaluate till a string is encountered

8 + 6 * -2 + 4 =0

"0" + (2 + 5) ="0"7

So, we have:

8 + 6 * -2 + 4 + "0" + (2 + 5) = 0"0"7

(c)\ 1 + 1 + "8 - 2" + (8 - 2) + 1 + 1

Evaluate till a string is encountered

1 + 1 = 2

"8 - 2" + (8 - 2) + 1 + 1 = "8 - 2"611

So, we have:

1 + 1 + "8 - 2" + (8 - 2) + 1 + 1 = 2"8 - 2"611

(d)\ 5 + 2 + "(1 + 1)" + 4 + 2 * 3

Evaluate till a string is encountered

5 + 2 =7

"(1 + 1)" + 4 + 2 * 3 = "(1 + 1)"46 --- multiply 2 and 3, then concatenate

So, we have:

5 + 2 + "(1 + 1)" + 4 + 2 * 3= 7"(1 + 1)"46

(e)\ "1" + 2 + 3 + "4" + 5 * 6 + "7" + (8 + 9)

Since a string starts the expression, the whole expression will be concatenated except the multiplication and the expressions in bracket.

So, we have:

"1" + 2 + 3 + "4" + 5 * 6 + "7" + (8 + 9) = "1"23"4"30"7"17

You might be interested in
Select the correct answer from each drop-down menu. Susan has decided to develop a website on a WYSIWYG editor. What kind of set
Natalija [7]

Answer:

the ans is b

Explanation:

i did it on edge

8 0
3 years ago
Examples of hacking languages​
Rufina [12.5K]

Answer:

SQL

C

JavaScript

PHP

C++

Java

Ruby

Explanation:

3 0
3 years ago
taking small bits of information from the internet/web and using it as my own work or to complete an assignment is plagiarism.
lana66690 [7]
Not necessarily, if you are sourcing the information you have used to come to your own conclusion then that isn't plagiarism, however if you just copy paste completely and use it as your own work then yes it is plagiarism.  <span />
7 0
3 years ago
Americans overwhelmingly support organ and tissue donation.
Simora [160]

This statement would be TRUE


7 0
4 years ago
Write a function that takes in input an English Sentence and prints the total number of vowels and the total number of consonant
Galina-37 [17]

Answer:

public static void vowelsConsonantCount(String str){

       String text = str.toLowerCase();

       String word = text.replaceAll("[^a-zA-Z0-9]", "");

       int lenWord = word.length();

       int count = 0;

       for(int i=0; i<lenWord; i++){

           if(word.charAt(i)=='a'||word.charAt(i)=='e'||word.charAt(i)=='i'

                   ||word.charAt(i)=='o'||word.charAt(i)=='u'){

               count++;

           }

       }

       int consonants = lenWord-count;

       System.out.println("the total vowels are "+count);

       System.out.println("The total consonants are: "+consonants);

   }

Explanation:

  • In Java programming language
  • The method uses java's replaceAll() method to remove all spaces and special characters and punctuations.
  • It converts the string entered into all lower cases using toLowerCase() method
  • Calculates the length of the resulting string using the length() method
  • Using if statement the total vowels are counted, subtracting the total vowels from the size of the string gives the total consonants
  • These two values are outputed.
5 0
3 years ago
Other questions:
  • What three characteristics of a function are described in an IPO chart? What is performed at each characteristic?
    12·1 answer
  • In her presentation, Emily has inserted two tables in a slide and formatted the text on all slides. Which feature of the present
    12·1 answer
  • Write a main method that prompts the user for an integer between 1 &amp; 20 (inclusive). If the user enters an invalid number, p
    8·1 answer
  • How does kinetic energy affect the stopping distance of a small vehicle compared to a large vehicle?
    14·2 answers
  • Which of the following would be a show stopper for the development of an enterprise mobile app? The app demands data throughput
    11·1 answer
  • If a small monster collector:- Has 16 small monster containment devices and intends to use all of them.
    10·1 answer
  • PLEASE HELP ME WITH THIS i will mark you brainlist
    6·1 answer
  • I WILL GIVE BRAINLIEST TO WHOEVER HELPS ME
    5·1 answer
  • In best practice, should you use all lowercase, all uppercase or a mixture of cases in HTML tag names?
    5·1 answer
  • Which of the following file formats allows you to share and save documents
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!