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
natali 33 [55]
3 years ago
6

Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the co

rrect way to read data from the file until the end of the file is reached?
a) while (inputFile != null)
b) while (!inputFile.EOF)
c) while (inputFile.hasnextInt())
d) while (inputFile.nextLine == " ")
Computers and Technology
1 answer:
12345 [234]3 years ago
4 0

Answer:

The correct answer to the following question is an option c) while (inputFile.hasnextInt()).

Explanation:

hasnextint() is the function of the scanner class which is "java.util.Scanner".

This method returns the boolean value so the data type of this method is boolean.

Integer values of radix are assumed only when a next token is in the Scanner input and it returns output True.

The other options are false because the input file can be null and the end of file is not equal to the input file and the next line is equal to the space and also the other options are not the object of the scanner class.

You might be interested in
Write a c program that reprints input so that no line is longer than 50 characters. Specifically, for lines less than or equal t
Alex73 [517]

Using the knowledge in computational language in C++ it is possible to write a code that reprints prints input so that no line is longer than 50 characters.

<h3>Writting the code:</h3>

<em>#include<stdio.h></em>

<em />

<em>int main(int argc, char** argv){</em>

<em>    //creating pointer to read a file</em>

<em>    FILE * fp;</em>

<em>    char * line = NULL;</em>

<em>    size_t len = 0;</em>

<em>    ssize_t read;</em>

<em>    int i=0;</em>

<em>    //opening a file</em>

<em>    fp = fopen(argv[1], "r");</em>

<em>    //handling the error condition</em>

<em>    if (fp == NULL){</em>

<em>        printf("File not found..!!");</em>

<em>        return 0;</em>

<em>    }</em>

<em>    int moreThan50 =0;</em>

<em>    //reading a file line by line</em>

<em>    while ((read = getline(&line, &len, fp)) != -1) {</em>

<em>        i = 0;</em>

<em>        if(read >= 50){</em>

<em>            moreThan50++;</em>

<em>        }</em>

<em>        while(i < read){</em>

<em>            if(line[i]!='\n'){</em>

<em>                if(i%50 == 0){</em>

<em>                    printf("\n%c",line[i]);</em>

<em>                }else{</em>

<em>                    printf("%c",line[i]);</em>

<em>                }</em>

<em>            }</em>

<em>            i++;</em>

<em>        }</em>

<em>    }</em>

<em>    printf("\nTotal lines over 50 chars: %d\n",moreThan50);</em>

<em>    printf("Offending Lines: ");</em>

<em>    for(i=1;i<=moreThan50;i++)</em>

<em>        printf("%d, ",i);</em>

<em>    fclose(fp);</em>

<em>    return 0;</em>

<em>}</em>

See more about C++ at brainly.com/question/19705654

#SPJ1

4 0
2 years ago
Why can’t web apps send notifications to a device’s taskbar when the app is closed?
tangare [24]
Web apps can't send notifications when it's closed because it is not installed into the device as a software program, meaning it doesn't have enough access to do so. Plus you are closing it down so how is something that you close down supposed to work?
8 0
4 years ago
In what way are high-level programming languages limited? (5 points)
Nat2105 [25]

Answer: High-level computer languages must be translated into assembly or machine languages by a compiler before they can be executed, making them slightly slower to execute than raw assembly or machine language. The answer is D.

4 0
3 years ago
Read 2 more answers
Provide an example by creating a short story or explanation of an instance where availability would be broken.
ryzh [129]

Incomplete/Incorrect question:

Provide an example by creating a short story or explanation of an instance where confidentiality would be broken.​

<u>Explanation:</u>

Note, the term confidentiality refers to a state or relationship between two parties in which private information is kept secret and not disclosed by those who are part of that relationship. Confidentiality is broken when this restricted information is disclosed to others without the consent of others.

For instance, a Doctor begins to share the health information of a patient (eg a popular celebrity, etc) with others such as his family members and friend

s without the consent of the celebrity.

6 0
3 years ago
What is the operating system in a computer?
vaieri [72.5K]

The answer to this question would be the last choice. The master program that controls the system hardware.

All computers require a software known as the <em>operating system</em> to properly function and allow you to use the computer. This operating system works as a "master program" that manages the computer's processes and memory.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which connector is most commonly used to connect printers to desktop pc systems?
    10·1 answer
  • What does a file extension tell you?
    14·1 answer
  • Local variables:
    7·1 answer
  • Design a 4-to-16 line Decoder by using the two 3*8 decoder-line decoders. The 3-to-8 line decoders have an enable input ( '1' =e
    13·1 answer
  • On dynamic disks, the term partition is not used to define the space where a file system is installed. what term is used?
    6·1 answer
  • Which THREE devices can perform both input and output operations?
    8·2 answers
  • A student should always read the directions to a test or question so they know what is expected of them when answering the quest
    9·2 answers
  • When an instruction is sent to the CPU in a binary pattern, how does the CPU know what instruction the pattern means
    7·1 answer
  • Why is time zone an important factor affecting when communicating
    14·1 answer
  • How do we add questions on sam Blockly?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!