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
Blababa [14]
3 years ago
12

A code segment will be used to swap the values of the variables a and b using the temporary variable temp. Which of the followin

g code segments correctly swaps the values of a and b?
a) a to b, temp to a, b to temp
b) temp to a, a to b, b to temp
c) temp to a, a to temp, a to b
d) temp to a, b to temp, a to b
Computers and Technology
1 answer:
shtirl [24]3 years ago
4 0

Answer:

Option (b)

Explanation:

These are the right statements but the correct order would be :

temp=b;

b=a;

a=temp;

Value of b will be stored in temp variables and then value of a will be stored in b and afterwards value of temp variable to a. This is how value of a &b will be swapped. Swapping is needed in various codes many times. For example - while sorting an array, while reversing a string,etc.

You might be interested in
How many slides would be in a PowerPoint presentation based on the formatting of the Word outline?
IrinaVladis [17]

Answer:

A. two

Explanation:

can i have brainliest please

5 0
3 years ago
Read 2 more answers
Which commas is used to combine two or more cells together into one cell
AURORKA [14]
The command is Merge & Center
This command could be easily found in the toolbar of your excel.
If you execute this command in two different cells, those cells will be merged into one larger cell and the content in that cells will be placed exactly in the middle of the combined cell (measures according to combined cells' length)
5 0
3 years ago
Andy wants to add a script on his website that will automatically update the current date when the script loads in the browser.
FrozenT [24]
The script that Andy would want to use is Javascript, here is the source code: document.getElementById("para1").innerHTML = formatAMPM();
function formatAMPM() {var d = new Date(),    minutes = d.getMinutes().toString().length == 1 ? '0'+d.getMinutes() : d.getMinutes(),    hours = d.getHours().toString().length == 1 ? '0'+d.getHours() : d.getHours(),    ampm = d.getHours() >= 12 ? 'pm' : 'am',    months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],    days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];return days[d.getDay()]+' '+months[d.getMonth()]+' '+d.getDate()+' '+d.getFullYear()+' '+hours+':'+minutes+ampm;<span>}

The HTML code needed to call this Javascript on his website is this: </span><span><div id="para1"></div>
</span>
You could call the Javascript up using PHP.

Hope this helps! Good luck! :) 
8 0
3 years ago
Excel spreadsheets are primarily used to
Ksivusya [100]

Spreadsheets are primarily used to work with numbers and text. Spreadsheets can help organize information.

8 0
4 years ago
Read 2 more answers
Two strings are anagrams if they are written using the same exact letters. Write a method to check if given two strings are anag
Andre45 [30]

Answer:

Check the explanation

Explanation:

import java.util.Scanner;

public class Anagrams {

   public static int count(String s, char ch) {

       int c = 0;

       for (int i = 0; i < s.length(); ++i) {

           if (s.charAt(i) == ch) {

               c++;

           }

       }

       return c;

   }

   public static boolean isAnagram(String s1, String s2) {

       char ch;

       s1 = s1.toLowerCase();

       s2 = s2.toLowerCase();

       for (int i = 0; i < s1.length(); ++i) {

           ch = s1.charAt(i);

           if (ch != ' ' && count(s1, ch) != count(s2, ch)) {

               return false;

           }

       }

       for (int i = 0; i < s2.length(); ++i) {

           ch = s2.charAt(i);

           if (ch != ' ' && count(s1, ch) != count(s2, ch)){

               return false;

           }

       }

       return true;

   }

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.print("Enter the first string: ");

       String s1 = in.nextLine();

       System.out.print("Enter the second string: ");

       String s2 = in.nextLine();

       if (isAnagram(s1, s2)) {

           System.out.println(s1 + " and " + s2 + " are anagrams");

       } else {

           System.out.println(s1 + " and " + s2 + " are NOT anagrams");

       }

   }

}

Kindly check the output image below.

4 0
4 years ago
Read 2 more answers
Other questions:
  • Find the simple interest Jay owes on a five-year student loan of $48,000 with an annual interest rate of 5%.
    9·1 answer
  • What is the most common threat on the internet? auction fraud illegal software computer viruses hackers?
    14·1 answer
  • Consider the function definition void Demo( int&amp; intVal, float floatVal ) { intVal = intVal * 2; floatVal = float(intVal) +
    7·1 answer
  • Mark lives in an area that is prone to tornadoes. If a tornado is headed his way, what is one thing Mark should do? A. Get in hi
    8·1 answer
  • Which of the following is a proper use of the application NetStumbler?Which of the following is a proper use of the application
    10·2 answers
  • Five batch jobs. A through E, arrive at a computer center at almost the same time. They hav e estimated running times of 10, 6,
    14·1 answer
  • hey guys just dropped some hot beats so go and follow me my user is the beats and comment if you would do that that would be gra
    11·1 answer
  • How many total cells can a worksheet window contain? If columns are labelled alphabetically, what will be the label for the cell
    15·1 answer
  • Write passage on computer virus​
    10·2 answers
  • Can someone please help me with this ,it is my assignment of technology and agriculture year 8
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!