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
ale4655 [162]
3 years ago
11

"in program arrays12.java a swap method is called. does the swap method exchange parameter values x and y?"

Computers and Technology
1 answer:
horrorfan [7]3 years ago
6 0
<h2>Yes the swap method exchange parameter values if passed by reference or the value gets changed inside the function.</h2>

Explanation:

Since the program is not given, I will try to guide you about the mode of parameters.

The meaning of swap is interchanging the values. It can be done by using temporary variable or without using it (if the values are integers).

While passing the parameters, there are two ways, call by value/pass by value and call by reference/ pass by reference.

If call by value, then the value gets swapped only inside the function and will not reflected in the calling portion. Call by reference is other way round.

You might be interested in
Analyze the following code: class Test { public static void main(String[] args) { System.out.println(xMethod((double)5)); } publ
SashulF [63]

Answer:

This code will give Error.

Explanation:

This code will give error because we have passed the argument 5 as double by using typecasting.We have two methods named xMethod but with arguments as int and long none of them has argument as double.The compiler will not be able to find the method with double argument.So this code will not run because of this reason.

3 0
3 years ago
Write a function flush that takes as input a list of five cards, tests whether it is a flush (Note: straight flush is not a flus
melamori03 [73]

Answer:

Explanation:

ef poker(hands):

   scores = [(i, score(hand.split())) for i, hand in enumerate(hands)]

   winner = sorted(scores , key=lambda x:x[1])[-1][0]

   return hands[winner]

def score(hand):

   ranks = '23456789TJQKA'

   rcounts = {ranks.find(r): ''.join(hand).count(r) for r, _ in hand}.items()

   score, ranks = zip(*sorted((cnt, rank) for rank, cnt in rcounts)[::-1])

   if len(score) == 5:

       if ranks[0:2] == (12, 3): #adjust if 5 high straight

           ranks = (3, 2, 1, 0, -1)

       straight = ranks[0] - ranks[4] == 4

       flush = len({suit for _, suit in hand}) == 1

       '''no pair, straight, flush, or straight flush'''

       score = ([1, (3,1,1,1)], [(3,1,1,2), (5,)])[flush][straight]

   return score, ranks

>>> poker(['8C TS KC 9H 4S', '7D 2S 5D 3S AC', '8C AD 8D AC 9C', '7C 5H 8D TD KS'])

'8C AD 8D AC 9C'

5 0
3 years ago
What is a WYSIWYG program?
DanielleElmas [232]
D will be the answer a program that allows you to take a tutorial on html terminology
5 0
3 years ago
Read 2 more answers
Cmo se puede añadir amigo ??'
seropon [69]

Answer:ok

Explanation:

5 0
3 years ago
There are two kinds of emotions: positive and negative. True False
fgiga [73]

Answer:

False

Explanation:

There are many emotions the human brain can experience

6 0
2 years ago
Read 2 more answers
Other questions:
  • Days of the week are represented as three-letter strings ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"). Write a javaScript f
    14·1 answer
  • A typical serial cable has
    13·1 answer
  • How would Microsoft Word inform you of the error in the sentence below? (Tip: The error is in bold.)
    7·1 answer
  • What is the name of the contextual or specific tab that appears in page layout view when adding a header
    15·1 answer
  • Help PLEASE (in attachment)
    8·1 answer
  • Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    14·1 answer
  • Can someone start me off with a short 2 or 3 paragraphs about the pros and cons of Microsoft Word, and if you can recommend a si
    12·1 answer
  • The illustration shows different types of text language.
    5·2 answers
  • Were can i watch unexpected free season 3
    9·1 answer
  • Question in photo below
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!