pls answer all how many asterisks does the following code fragment print?
Q: 2. Let C be an (n, k, d)x code. Then it can be converted into an (n– 1, k, d – 1)x code.
A: #include <stdio.h>#include <math.h>void findNumberOfDigits(long n, int base){ int dig =…
Q: Show the printout of the following code:students = {"peter",…
A:
Q: b) Find the errors and correct them: 1) int sum 0;x; do{ cin<<x; Sumt-x;] while(x!-0.0) 2) (for int…
A: 1) variable names are case sensitive in CPP. The correct code is: int sum=0,x; do{ cin>>x;…
Q: Reimplement the digital clock from the preceding exercise, representing the time as the minutes from…
A:
Q: Generate and store 200 even numbers starting from ENUM with the number 1000 counting up ?
A:
Q: Find the errors to print the following series: 6.1 6.4 6.7 7.0 7.3 7.6 7.9 int i; for ( i= 6.1, i> z…
A: The errors along with the correct code is given below:
Q: write code to arrange the days and Print the name of day and examine of the day is holiday not…
A: startDate = '01 Jan 2016';startDN = datenum(startDate, 'dd mmm yyyy');dur_days = 10;startDV =…
Q: Given that the addition operator has precedence over the multiplication. What is the result of the…
A: Given that addition operator has precedence over multiplication. Given expression: (--a) + 2 * 9…
Q: What's the time complexity of this code? We can't have 0 in the denominator. I am so confused
A: the answer is below:
Q: Develop the code for the round robin algorithm in java using forms. Write the code on the computer,…
A: Answer - Round Robin(RR) is a CPU scheduling algorithm. In RR scheduling specific time slot is…
Q: i <- 1 while i (i < 10) { print(i) i i <- i + 1 }
A: 1) Above R programming code prints numbers from 1 to 9 value of variable i is assign to 1 while…
Q: Develop the code for the round robin algorithm in C# using forms. Write the code on the computer,…
A: Firstly what is Round Robin Scheduling - It is a job-scheduling algorithm which uses time…
Q: Show what is printed by the following code.
A: 1. In the queue data item is inserted on the rear and removed from front 2. Enqueue operation on…
Q: What is the value of the expression x >= 50 && x <= 100 if x is 45, 67, or 101?
A: Answer: In the above given expression we have the value of x is 45,67 or 101. Now we have to check…
Q: What is the output of this code segment when the input value of x equal 9, input value of y equal 2…
A: The inputs are accepted through the textboxes which are values of x, symbol and y
Q: Trace the following pieces of code and give their exact output and the tracing steps.
A: Given: Trace the following pieces of code and give their exact output and the tracing steps.
Q: omplete the dry run table for the fragment of code given:
A: CODE representation: this code includes step by step changes in a, b and c #include…
Q: Show me the simplest branching code (print odd or even number) that
A: Input a number from user Then check the remainder using if condition and print respective statement
Q: What is the difference between the prefix and postfix increments?
A: prefix and postfix are increments are just two common simple ways to increment a value by 1 If the…
Q: Q5 Python code to Produce and print the first 10 sentences of the Fibonacci series. Fibonacci…
A: Algorithm : 1. Start 2. Declare num1=1 , num2=1, i=2 3. Print(num1, num2) 3. While(i<10) go to…
Q: Rewrite Exercise 3.4 using the following func tion to return the area of a pentagon: def area(s):
A: Given: Rewrite Exercise 3.4 using the following func tion to return the area of a pentagon: def…
Q: For the following code the equation 1. y 0 2. i n 3. While i 20 4. do y ai +x.y i fi- 1 5. What is…
A:
Q: Home work/write aProgram to Implementation Using functlon ? 07 00 this selies 08.00 Function pha…
A: #include<iostream> using namespace std; int fact(int n){int f=1;for(int…
Q: What does the following Java coding snippet print?
A: To be determine: Select right option for give code
Q: Let r and s be regular expressions. Which of the following regular expression equivalences is…
A: The correct "(r+s)∗≡(r∗s∗)∗"Option"4"
Q: Write a code to enter values, print, and search using binary search in a single filter and of the…
A: public class Main{ public static void binarySearch(int A[], int f, int l, int key){ int m = (f +…
Q: What do you think will happen when the operands to the integer divisionor remainder operations are…
A: Lets see the solution.
Q: What is the value of bits[4] after the execution of the following code snippet?
A: we have to give output of the program
Q: For the following code the equation 1. y 40 2. i fn 3. While i 20 4. do y ai + xy i fi- 1 5. What is…
A: Answer: So, Asymptotic running time of given fragment = O(n)
Q: 4. Boolean algebra a, b, and c are Boolean variables. F(a, b, c) is a Boolean function with the…
A: The all three parts to be solved below:
Q: Fill in the blanks in the given code such that it prints the variable I only if i is less than 6.
A: Complete the given JAVA code to print the variable i in the output only if the value of i is less…
Q: Print the * * * Following patter in **
A: declaring number of rows to be iterated. running loop in reverse display pattern
Q: Describe the following sets by regular expressions, (c) {01, 10} (d) {а, ab].
A: The Answer is
Q: Consider the following code segment. result « REPEAT UNTIL(x > 5 result + result + x X + 1 What is…
A:
Q: Use Matlab to write a function that calculates the area of a triangle given length of the three…
A: Write a MATLAB Function that finds the area of a triangle. The inputs are the length of the three…
Q: Write a java code for the following . Write a Java program to print the unique elements along with…
A: Read the elements of the array if not repeated then and then check. How many of them are present.…
Q: Give the result of the following code:
A: given the program , output is given below with explanation
Q: Ql: Write java program that received two numbers from the user and return the summation and…
A: ALGORITHM:- 1. Take input for 2 numbers from user. 2. Create 2 classes for Addition &…
Q: What is the output of this code segment when the input value of X equal 100.
A: Out of range
Q: Write python code to print difference between 55th term of Fibonacci series and 45th term * 5th term…
A: HI THEREI AM ADDING ANSWER BELOWPLEASE GO THROUGH ITTHANK YOU
Q: Q1. Given the following expression: 8 + b – c * (x * 2 ^ 6) – m / 7 [Show how the expression is…
A: Objective: An infix expression is given and the expression should be converted into the postfix…
Q: Assuming the code x = (y++) / (-y) * (++y) + (y--); has been executed correctly that y=5, what is…
A: - We have to get the value of x when y has operations given.
Q: a) How many possible numbers are there? b) How many are palindromes? c) How many are palindromes…
A: First number of length 6 is 100000 so there are #100000 upto length 5 where taking 0 as first and…
Q: Choose the correct answer for following piece of C++ code
A: Answer: Option A a is pass by value and b is pass by reference
Q: · Trace the following pieces of code and give their exact output.
A: 1. --p is a pre decrement operator. That is it will first decrement value of p by 1 and then…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
- OBJECT: To compute the net pay of an employee, given his/her pay rate, number of hours, and tax rate. INPUT: his/her name, pay rate, and number of hours. You will prompt the user with a friendly message to enter the employee’s name, pay rate and number of hours. Note that you must use the dash (-) to connect the first name to the last name so that the name can be read using the cin statement. For example, John-Doe OUTPUT: the employee’s gross pay, tax deduction, and net pay. For example: Name: John-Doe Your gross pay is: 900.00 Your tax deduction is: 90.00 Your net pay is: 810.00 METHOD: the gross pay is the pay rate times the number of hours. The tax deduction is computed as follows: If the gross pay is less than 1000.00, it is 10% of the total pay; otherwise, it is 15% of the gross pay. The net pay is the gross pay minus the tax deduction. TOPICS:…Write a code for craps game. Craps is a dice game in which the players make wagerson the outcome of the roll, or a series of rolls, of a pair of dice.The rules of the dice game craps are as follows:You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots,respectively. After the dice have come to rest, the sum of the spots on the two upward faces iscalculated. If the sum is 7 or 11 on the first throw, you win and play is over. If the sum is 2, 3or 12 on the first throw you lose and play is over. If the sum is 4, 5, 6, 8, 9 or 10 on the firstthrow, that sum becomes your “point.” To win, you must continue rolling the dice until you“make your point” (i.e., roll that same point value). You lose by rolling a 7 before making yourpoint(in python)Write a code for craps game. Craps is a dice game in which the players make wagerson the outcome of the roll, or a series of rolls, of a pair of dice.The rules of the dice game craps are as follows:You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots,respectively. After the dice have come to rest, the sum of the spots on the two upward faces iscalculated. If the sum is 7 or 11 on the first throw, you win and play is over. If the sum is 2, 3or 12 on the first throw you lose and play is over. If the sum is 4, 5, 6, 8, 9 or 10 on the firstthrow, that sum becomes your “point.” To win, you must continue rolling the dice until you“make your point” (i.e., roll that same point value). You lose by rolling a 7 before making yourpoint.
- Assume that a box of apples cost 8 dollars and a box of grapes cost 6 dollars. Given variables numBoxApples and numBoxGrapes that are read from input, compute the total cost and assign combinedCost with the result. Ex: If the input is 7 10, then the output is: Cost: 116 include <iostream> using namespace std; int main() { int applePrice = 8; int grapePrice = 6; int numBoxApples; int numBoxGrapes; int combinedCost; cin >> numBoxApples; cin >> numBoxGrapes; /* Your code goes here */ cout << "Cost: " << combinedCost << endl; return 0; }Assignment Write a program that moves a forester unit and a desert corps unit to a given target location and prints the number of hours it took for each unit to reach the target. First, the user will give the starting X and Y positions of the forester unit as well as its base speed (all ints). Then, the starting X and Y positions of the desert corps unit as well as its base speed (all ints). Finally, the target X and Y positions (both ints) and the terrain type (std::string). Speeds are given as distance traveled in one full day (i.e., 24 hours) and is affected by the terrain type using a multiplier over the base speed. Also, after 1 full day, each unit rests for a certain number of hours. Speed multiplier and rest amount of each type of unit depending on the terrain type are as below. Speed Multiplier Rest Duration After 1 day Terrain type Forester Desert Corps Forester Desert Corps Forest 1.3 0.6 4 12 Desert 0.4 1.2 15 6 Hills 0.7 0.8 6 8 Others 1.0 0.8 8 6 After getting all this…Craps is a single player dice game, that proceeds as follows:1. the player rolls 2 six-sided dice once if the total is 7 or 11, the player wins if the total is 2, 3 or 12, the player loses otherwise, the game continues, ... see 2 ... 2. the player the continues to roll the dice repeatedly, until ... the total is the same as the original total (from 1), in which case the player wins the total is 7, in which case the player loses Write a function craps using Python that simulates a single game of craps (may be many rolls) and returns 1 if the player wins and 0 otherwise. Sample results examples: >> import random>>> random.seed(0)>>> craps()0 >>> random.seed(1)>>> craps()1 >>> random.seed(2)>>> craps()0 >>> [ (i,random.seed(i),craps()) for i in range(20)][(0, None, 0), (1, None, 1), (2, None, 0), (3, None, 1), (4, None, 0), (5, None,1), (6, None, 0), (7, None, 1), (8, None, 0), (9, None, 0), (10,…
- Assume that int a[ 2 ][ 2 ] = { { 1, 2 }, { 3, 4 } }; the value of a[ 1, 1 ] = ______;What will the following code display?try:x = float('abc123')print(x)except IOError:print('This code caused an IOError.')except ZeroDivisionError:print('This code caused a ZeroDivisionError.')except:print('An error happened.')print('The end.')Examine the following code segment. What will be printed? If there are any errors indicate the nature of the error. int a[9] = { 1, 12, 3, 14, 25, 16, 7, 8, 9 }; int *ptr ; ptr = & a[ 2 ] ; for( i = 1; i <= 5; i = i + 2) cout << a[i] << *( ptr + i ); cout << ” ” << a[0] << ” ” << *ptr << ” ” << *ptr - 1 << ” ” << *(ptr - 2));
- Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 9. Given the following code, the output is the date and time of __.Calendar cal = Calendar.getInstance(); TimeZone tz = TimeZone.getTimeZone("Europe/Rome");TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");TimeZone tz = TimeZone.getTimeZone("Asia/Istanbul");System.out.println(cal.getTime()); A. the "Europe/Rome" time zone.B. the time zone is computer is currently set to use.C. the "America/Los_Angeles" time zone.D. the "Asia/Istanbul" time zone.E. All of the three listed time zones. Part 2 - 10. Given the following code, the output is the date and time of __. Calendar cal = Calendar.getInstance();TimeZone tz = TimeZone.getTimeZone("Europe/Rome");cal.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));TimeZone tz = TimeZone.getTimeZone("Asia/Istanbul");System.out.println(cal.getTime()); A. the "Europe/Rome"…What does the following code segment display? for(f=0; f<3; ++f); write ("{0} ", f); a. 0 b. nothing c. 3 d. 0 1 2Twin primes are a pair of prime numbers that differ by 2. Forexample, 3 and 5 are twin primes, 5 and 7 are twin primes, and 11 and 13 aretwin primes. Write a program to find all twin primes less than 1,200. Display theoutput as follows:(3, 5)(5, 7)...