Decisions in Java – Comparing Strings WS
1. For each of the following pairs of strings, state, with reasons, which string precedes the other.
(a) "cat" and "dog" (b) "cat" and "Cathy" (c) "X " and " X"
(d) "cab" and "car" (e) "XX" and "X X" (f) "XY" and "XY " (g) "375" and "84" (h) "" and " "
2. State the value of each expression.
(a) "one".equals("one ")
(b) (b) "two".equals("2")
(c) "Three".equals("Three")
(d) "four".equals("for")
3. State whether the value of the expression is negative, zero, or positive.
(a) "for".compareTo("fore")
(b) "fore".compareTo("force") (c) "force".compareTo("Force") (d) "Force".compareTo("Farce") (e) "Farce".compareTo("Fare") (f) "Fare".compareTo("far")
(g) "far".compareTo("far")
(h) "far".compareTo("far ")
1. use compareTo() method
(a) "cat" and "dog" ----- cat, c is smaller than d
(b) "cat" and "Cathy" ---- Cathy, C is smaller than c
(c) "X " and " X" --- " X", space is smaller than X
(d) "cab" and "car" ---- cab, b is smaller than r
(e) "XX" and "X X" ---"X X"
(f) "XY" and "XY " --- "XY"
(g) "375" and "84" ---- "375", 3 is smaller than 8
(h) "" and " " ------ ""
2. State the value of each expression.
(a) "one".equals("one ") ------- false, difference of space ()
(b) (b) "two".equals("2") ---------- false
(c) "Three".equals("Three")-------- true, all characters in the strings are same
(d) "four".equals("for")------------ false
3.
(a) "for".compareTo("fore")---- -1, small and larger string
(b) "fore".compareTo("force") --- 2 , difference between c and e
(c) "force".compareTo("Force") ---- 32, difference between F and f
(d) "Force".compareTo("Farce") ---- 14, difference between o and a
(e) "Farce".compareTo("Fare") --- -2, difference between c and e
(f) "Fare".compareTo("far") --- -32, difference between F and f
(g) "far".compareTo("far") ----- 0 , both are equal
(h) "far".compareTo("far ") ----- -1, small and larger string
Do ask if any doubt. Please upvote.
Decisions in Java – Comparing Strings WS 1. For each of the following pairs of strings,...
help 3. Answer each part for the following CFG G (The * symbom in the derivation means with any number of steps): R + XRXS S + aTb | b Ta T→ XTX | x | 6 X + ab (a) What are the variables of G? (b) What are the terminals of G? (c) Which is the start variable of G? (d) Give three strings in L(G) (e) Give three strings not in L(G) (f) True or False: T...
please tell me how to do (p), (s), (t). 85 Exercises EXERCISE 1 on for each of the following languages. Give a regular expression for each of the follow ke the machine from 0 back, a. label rip from 0 back co state 0 on an input b. {abc, xyz] c. a, b, d. {ax | x € {a,b]"} e axb | x € {a,b}} [ {(ab)"} assing through 0. bo a piece we already have a input string. So...
The state space model of an interconnected three tank water storage system is given by the following equation -3 1 o 1[hi] dt The heights of water in the tanks are, respectively, hi, h2, hz. Each tank has an independent input flow; the volume flow rates of input water into the three tanks are, respectively, qii,qi2, Oi3. Each tank also has a water discharge outlet and the volume flow rates of water coming out of the tanks are, respectively, qo1,...
The state space model of an interconnected three tank water storage system is given by the following equation: -3 1 0 1rh dt os lo 0 3] 10 1-3 The heights of water in the tanks are, respectively, h,h2,h3. Each tank has an independent input flow; the volume flow rates of input water into the three tanks are, respectively, qǐ1,W2,4a. Each tank also has a water discharge outlet and the volume flow rates of water coming out of the tanks...
1. Animals can teach us genetics. Match Codominance Show a dominant and recessive relationship _An allelic series A dominant homozygote is lethal Coat coloration is determined by 2 genes Shows variable expressivity A qualitative, or continuous, trait involving polygenes Females mosaics for X-linked heterozygous color genes A. Manx cat B. Coat coloration rabbits C. Labrador retriever dogs D. Piebald spotting in beagles E. A and B blood alleles F. A and O blood alleles G. Calico cat H. Height of...