answer.
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
serious [3.7K]
2 years ago
9

#include ... void sig_handler(){ static int i = 1; printf("Beep\n"); alarm(i); ++i; } int main(){ struct sigaction sa; sa.sa_fla

gs = 0; sa.sa_handler = sig_handler; if(sigaction(SIGALRM, &sa, NULL) != 0){ printf("Failed to bind handler.\n"); exit(1); } printf("Going into an infinite loop.\n"); alarm(1); while(1); return 0; }
Suppose the above program is run for 7.5 seconds after it prints "Going into an infinite loop". The program is run multiple times where the "system load" from other processes sharing the cpu will vary from none to many other processes. Which best characterizes how many times "Beep" is printed?
Computers and Technology
1 answer:
anygoal [31]2 years ago
3 0

Answer:

Explained below

Explanation:

After the compiling the program it prints "Going to infinite loop" after that i started the timer till 4.5 sec. The program prints more than 4 beeps nearly 6-7 beep messages were printed.

The number "Beep" would always be strictly greater than 4.

Hence, if the above program is run for 7.5 seconds after it prints "Going in an infinite loop", it will print Beep for about 9-10 times. Hence, the number will always be greater than 7

You might be interested in
Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the n
mote1985 [20]

Answer:

import java.util.Scanner;

public class VowelsAndConsonantsDemo {

   /**

   The printMenu methods displays a menu to the user

    */

   public static void printMenu() {

       System.out.println("Please select an option: ");

       System.out.println();

       System.out.print("a. Count the number of vowels in the string.\n"

               + "b. Count the number of consonants in the string.\n"

               + "c. Count both the vowels and consonants in the string.\n"

               + "d. Enter another string.\n"

               + "e. Exit the program\n");

   }

   public static void main(String[] args) {

       String input;      // to hold the user's input

       String option;     // to hold the user's input

       char choice;       // to hold a single character

       char exit;         // user chooses 'e' to exit the program

       char letter;       //the Y or N from the user's decision to exit

       // create a Scanner object to read keyboard input.

       //  Scanner keyboard = new Scanner(System.in);

       Scanner keyboard;

       do {

           keyboard = new Scanner(System.in);

           // ask user to enter string

           System.out.print("Enter a string: ");

           input = keyboard.nextLine();

           input = input.toLowerCase();

           System.out.println();

           printMenu();

           option = keyboard.nextLine();

           choice = option.charAt(0);

           VowelsAndConsonants words = new VowelsAndConsonants(input);

           switch (choice) {

               case 'a':

               case 'A':

                   System.out.println("Number of Vowels: " + words.getVowels());

                   break;

               case 'b':

               case 'B':

                   System.out.println("Number of Consonants: " + words.getConsonants());

                   break;

               case 'c':

               case 'C':

                   System.out.println("Number of Vowels & Consonants: " + words.getConsonants()

                           + words.getVowels());

                   break;

               case 'd':

               case 'D':

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

                   break;

               case 'e':

               case 'E':

                   System.exit(0);

                   break;

               default:

                   System.out.println("You did not enter a valid choice.");

           }

           //

           // keyboard.nextLine();    //consumes the new line character after the choice

           // String answer = keyboard.nextLine();

           // letter = answer.charAt(0);

       } while (true);

   }

}

4 0
1 year ago
Write a algorithm to attend birthday party​
kolezko [41]

Answer:

2     No

5 14    Yes

Explanation:

8 0
1 year ago
Read 2 more answers
What is a cursor?
Genrish500 [490]
I would say C because it's a movable indicater on a screen
8 0
1 year ago
Read 2 more answers
how do you make a circuit so 1 switch will turn on/off all the lights(3 lights) and a second switch will change the lights from
expeople1 [14]

Parallel circuit. On a wire you put the lights and one switch, on the other you put a resistor and another switch. (and the third wire contains the generator)
7 0
1 year ago
Read 2 more answers
Develop an sec (single error correction) code for a 16-bit data word. generate the code for the data word 0101000000111001. show
Kipish [7]

Answer:

code = 010100000001101000101

Explanation:

Steps:

The inequality yields 2^{k} - 1 > = M+K, where M = 16. Therefore,

The second step will be to arrange the data bits and check the bits. This will be as follows:

Bit position              number              Check bits            Data Bits

21                                   10101

20                                  10100

The bits are checked up to bit position 1

Thus, the code is 010100000001101000101

3 0
2 years ago
Read 2 more answers
Other questions:
  • your monthly living expenses are $1500 on an income of $1,650 per month. your goal is to have an emergency fund of 4 times your
    5·1 answer
  • Gloria needs to show in spreadsheet form the number of students in her class who speak different languages. Which type of graph
    7·1 answer
  • A major weakness of a lot of file processing systems is that ____.
    10·1 answer
  • Julie is working on a spreadsheet with data about the company's profits. They will be sharing this data with customers. She chec
    6·2 answers
  • In your own words, what is pair-programming? What is the role of the driver? What is the role of the navigator? What are some be
    15·1 answer
  • The kings and queens of England are listed in a relation Kings(name,nickname,house,beginReign,endReign). Their name is unique, e
    8·1 answer
  • Write a client program that writes a struct with a privateFIFO name (call it FIFO_XXXX, where XXXX is the pid that you got from
    11·1 answer
  • In cell E6, create a formula to calculate the percentage of total sales accounted for by DVDs. The formula will divide DVD sales
    15·1 answer
  • A machine is having issues, so the user is responsible for getting the machine serviced. Which stage of the hardware lifecycle d
    13·1 answer
  • Checkpoint 10.43 Write an interface named Nameable that specifies the following methods: _______{ public void setName(String n)
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!