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
wariber [46]
3 years ago
7

2-Write test programs in java to determine the scope of a variable declared in a for statement. Specifically, the code must dete

rmine whether such a variable is visible after the body of the for statement

Computers and Technology
1 answer:
ankoles [38]3 years ago
7 0

Answer:

See Explaination

Explanation:

public class testscope

{

//start of main function

public static void main(String[] args)

{

//varible declration

int i;

int x;

//loop for 10 times

for(i=0; i<10; i++)

{

//initialize value of x to 10

x = 10;

}

//the scope of variable x is visible outside of for loop

System.out.println("The value of x is: "+x);

}

}

See attachment for sample output

nb:

You can clearly see in the output of Java program the value of x is not printed and program return errors. It means the variable x declared inside for loop does not has scope outside the for loop.

You might be interested in
Which of the following statement about device formatting is FALSE?
notsponge [240]

Answer:

The correct option is;

A) Device manufacturers store the initial file-system data structures in the device.

Explanation:

Before a storage device can be used for data storage, it is required to prepare the device for use and to make the device to become visible to the operating system by formatting of the device

New storage devices are not pre-formatted or come with a ready to use file system as there are different file systems specifically designed for particular  operating systems or operating environment.

Formatting creates partitions, makes the hard drive visible to the operating system and creates a file system that is new such that the storage device can be used for storing files.

4 0
3 years ago
Most computers include a network card designed to connect a computer to the net using standard telephone service. True or False?
navik [9.2K]
I believe the answer is false
6 0
3 years ago
Show a parse tree and a leftmost derivation for : B = C * (A + B)
11111nata11111 [884]

Answer:

mhyfocnu,sobgu,kvngwugwe8hri

Explanation:

sovijbjxyzkuvcg

7 0
3 years ago
Which validation check can be used on the following data. "XX000" 
zalisa [80]

Answer:

Format and Length

Explanation:

If there is a range or limit on the data, you would need to know more about the format.

4 0
3 years ago
Can someone help answer this. I'm on a time crisis rn and need to pass or I fail the class. There are games that cannot be descr
const2013 [10]
  • There are games that cannot be described as a single or two genres.
  • Yes there should be some genres invented.
  • Because games are now become a everyday requirement for entertainment .

Uses of genre:-

  • Genres are used in Readers as well as writers.
  • By using genre patterns in writers it has been accepted by readers for accomplishing their purposes.
  • Genres allow both writers and readers to establish a working relationship between each other.
  • Both writers and readers are required for gamers and game publishers.
  • So Genres are very useful to them.
5 0
3 years ago
Other questions:
  • This is not a removable media device
    15·1 answer
  • What is the name of small programs stored on the hard drive that tell the computer how to communicate with a specific hardware d
    5·1 answer
  • Help!!! Who is this? Who is it from?
    14·2 answers
  • What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be generated intentionally by a user prog
    11·1 answer
  • What does the somaliland high population density <br>​
    15·1 answer
  • When computing the cost of the basket of goods and services purchased by a typical consumer, which of the following changes from
    11·1 answer
  • Write a function to output an array of ints on a single line. Funtion Should take an array and an array length and return a void
    9·1 answer
  • A user is connected to his personal mobile hotspot device at a library for internet access. He notices the display shows two con
    10·1 answer
  • Before a new email application could be released to the public, it was released for a few days to some account holders of a webs
    14·2 answers
  • Networks, partnerships, and joint ventures are an example of
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!