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
Shkiper50 [21]
2 years ago
10

Which of the following is NOT a valid method to increase a variable named score by 1?

Computers and Technology
1 answer:
Fofino [41]2 years ago
5 0

Answer:

a.

++score = score + 1

Explanation:

First you have to understand the increment operator;

There are three possible ways to increment the value of variable by 1.

1.  <u>post increment</u>

syntax:

name++

it using in expression first then increase the value by 1.

2. <u>Pre increment</u><u> </u>

syntax:

++name

it increase the value by 1 before it using in expression.

3. simple method

name = name +1

In the question,

option 1: ++score = score + 1

it increase the value of score by 2 because their are two increment is used first for (score + 1) and second ++score.

Therefore, the correct option is a.

You might be interested in
This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balance
aksik [14]

Answer:

import java.util.Scanner;

public class TeamRoster {

  public static void main(String[] args) {

     Scanner scan = new Scanner(System.in);

     int[][] players = new int[5][2];

     boolean keepAlive = true;

     char input;

     

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

        System.out.println("Enter player " + (i+1) + "'s jersey number: ");

        players[i][0] = scan.nextInt();

        if( players[i][0] >= 0 && players[i][0] < 100 ) {

             System.out.println("Enter player number less than 100");

               System.out.println("Enter player " + (i+1) + "'s rating: ");

               players[i][1] = scan.nextInt();

               if ( players[i][1] >= 1 && players[i][1] <10 ) {

                     System.out.println();

               }    else {

                     System.out.println("Enter player " + (i+1) + "'s rating: ");

                     players[i][1] = scan.nextInt();

               }

     }

     }

     System.out.println();

     outputRoster(players, 0);

     

     while (keepAlive) {

        outputMenu();

        input = scan.next().charAt(0);

        if (input == 'q') {

           keepAlive = false;

           break;

        } else if (input == 'o') {

           outputRoster(players, 0);

        } else if (input == 'u') {

           System.out.println("Enter a jersey number: ");

           int jerseyNum = scan.nextInt();

           System.out.println("Enter a new rating for the player: ");

           int newRating = scan.nextInt();

           for (int l = 0; l < 5; l++) {

              if (players[l][0] == jerseyNum) {

                 players[l][1] = newRating;

              }

           }

        } else if (input == 'a') {

           System.out.println("Enter a rating: ");

           int rating = scan.nextInt();

           outputRoster(players, rating);

        } else if (input == 'r') {

           System.out.println("Enter a jersey number: ");

           int jerseyNum = scan.nextInt();

           boolean exists = true;

           for (int l = 0; l < 5; l++) {

              if (players[l][0] == jerseyNum) {

                 System.out.println("Enter a new jersey number: ");

                 players[l][0] = scan.nextInt();

                 System.out.println("Enter a rating for the new player: ");

                 players[l][1] = scan.nextInt();

              }

           }

           

        }

     }

     

     return;

  }

   

  public static void outputRoster(int[][] players, int min) {

     System.out.println(((min>0) ? ("ABOVE " + min) : ("ROSTER")));

     int item = 1;

     for (int[] player : players) {

        if (player[1] > min) {

           System.out.println("Player " + item + " -- Jersey number: " + player[0] + ", Rating: " + player[1]);

        }

        item++;

     }

     System.out.println();

  }

   

  public static void outputMenu() {

     System.out.println("MENU");

     System.out.println("u - Update player rating");

     System.out.println("a - Output players above a rating");

     System.out.println("r - Replace player");

     System.out.println("o - Output roster");

     System.out.println("q - Quit\n");

     System.out.println("Choose an option: ");  

  }

}

Explanation:

The program is written in Java.

It is a bit straightforward.

The Scanner module is declared and used to collect input from the user.

The program prompts the user for each player jersey then rating.

All five players details are collected.

The program shows the output of all the entries.

5 0
2 years ago
Dashed lines that display on your slide when you are moving an object and that assist you with alignment are referred to as:
Umnica [9.8K]
Smart guides is the answer.
7 0
2 years ago
Read 2 more answers
The random module is a group of functions that are used to deal with random numbers.
maksim [4K]
True because it is the
5 0
2 years ago
Read 2 more answers
in Google, how should you phrase your search if you want to exclude a certain word from your results(for example,"chocolate")?
dusya [7]
I found this:
ou can exclude words from your search by using the - operator; any word in your query preceded by the - sign is automatically excluded from the search results. Remember to always include a space before the - sign, and none after

I found it here:
http://www.informit.com/articles/article.aspx?p=675274&seqNum=3
3 0
2 years ago
How much memory can be addressed in protected mode?
tamaranim1 [39]
Access to 4 gigabytes of memory



5 0
3 years ago
Other questions:
  • I need help please?!!!
    15·1 answer
  • Why do objects in the back seat move when the car turns
    11·1 answer
  • Within an event-driven program a component from which an event is generated is the ____
    10·1 answer
  • To implement a small database, a database designer must know the "1" and the "M" sides of each relationship and whether the rela
    7·1 answer
  • _____ involves storing data and running applications outside the company’s firewall. answer grid computing parallel computing cl
    11·1 answer
  • Do earthquakes ever happen in Malaysia?​
    8·1 answer
  • Which programming paradigm does the programming language JavaScript follow?
    14·1 answer
  • Something I should look for when trying to decide if a source is credible is the publication's ....
    10·1 answer
  • Math and science are the foundation from which drafters work<br><br> True<br> False
    8·1 answer
  • How do programmers recognise patterns, generalise and abstract information
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!