Find the largest number of divisions made by Euclid’s algorithm for computing gcd(m, n) for 1≤ n ≤ m ≤ 100.
In: Computer Science
Function named FunCount takes three arguments-
C, an integer representing the count of elements in input list
IP- input list of positive integers.
Item- an integer value.
Function FunCount returns an integer representing the
count of all the elements of List that are equal to
the given integer value Key.
Example: Don’t take these values in program, take all inputs from user
C = 9, IP= [1,1,4,2,2,3,4,1,2], Item = 2
function will return 3
In: Computer Science
Question 1: Windows’ Ping sends four echo requests (i.e., four ping requests) to a target by default. Based on what you did in Activity 1 of Lab 4 and/or some of the information available in the Appendix of the Lab 4 assignment (i.e., the last pages in the Lab 4 assignment), which of the following is the appropriate command for pinging target 172.217.4.36 by sending 4 echo requests without changing any of the default pinging options?
Question 2: Based on what you did in Activity 1 of Lab 4 and/or some of the information available in the Appendix of the Lab 4 assignment (i.e., the last pages in the Lab 4 assignment), which of the following commands can you use to ping the target 172.217.4.36 repeatedly until you stop the pinging yourself?
Question 3: You start pinging with the option of repeatedly pinging a target. Based on what you did in Activity 1 of Lab 4 and/or some of the information available in the Appendix of the Lab 4 assignment (i.e., the last pages in the Lab 4 assignment), which of the following can you use to stop the pinging?
In: Computer Science
Question 4: Using _______________________, you will ping sweep 5 targets.
Question 5: The following is not a valid Fping
command.
Note:
This question is about the Fping utility.
In: Computer Science
Add a CountGroups method to the linked list class below (OurList). It returns the number of groups of a value from the list. The value is passed into the method. A group is one or more values.
Examples using strings:
A list contains the following strings: one, one, dog, dog, one,
one, one, dog, dog, dog, dog, one, one, dog, one
CountGroup(“one”) prints 4 groups of one's
CountGroup(“dog”) prints 3 groups of dog's
Do not turn in the code below. Turn in only your method.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LinkListExample
{
public class OurList<T>
{
private class Node
{
public T Data { get; set; }
public Node Next { get; set; }
public Node(T paramData = default(T), Node paramNext = null)
{
this.Data = paramData;
this.Next = paramNext;
}
}
private Node first;
public OurList()
{
first = null;
}
public void Clear() // shown in class notes
{
first = null;
}
public void AddFirst(T data) // shown in class notes
{
this.first = new Node(data, this.first);
}
public void RemoveFirst() // shown in class notes
{
if (first != null)
first = first.Next;
}
public void AddLast(T data) // shown in class notes
{
if (first == null)
AddFirst(data);
else
{
Node pTmp = first;
while (pTmp.Next != null)
pTmp = pTmp.Next;
pTmp.Next = new Node(data, null);
}
}
public void RemoveLast() // shown in class notes
{
if (first == null)
return;
else if (first.Next == null)
RemoveFirst();
else
{
Node pTmp = first;
while (pTmp.Next != null && pTmp.Next.Next != null)
pTmp = pTmp.Next;
pTmp.Next = null;
}
}
public void Display() // shown in class notes
{
Node pTmp = first;
while (pTmp != null)
{
Console.Write("{0}, ", pTmp.Data);
pTmp = pTmp.Next;
}
Console.WriteLine();
}
public bool IsEmpty() // shown in class notes
{
if (first == null)
return true;
else
return false;
}
}
}
In: Computer Science
In: Computer Science
Python 3.7:
1. Write a generator expression that repeats each character in a given string 4 times. i.e. given “gone”, every time you call the next method on the generator expression it will display “gggg”, then “oooo”, … etc and instantiate it to an object called G. G = (…..) # generatorExpression object
2. Test and verify that iter(G) and G are the same things. What does this tell you about the nature of a Generator object/expression?
3. Assign Iter(G) to an iterator object called it1 and advance it to the next element by using next method.
4. Instantiate a new Iter(G) object called it2. Use the next method and advance it to the next element. Observe the result and compare it with the results of it1.
5. Does the new Iter(G) object start the iterator from the start of the string object? Write down your understanding/conclusion from this experiment.
6. How can you get back the Iter(G) to point back to the beginning of the string?
In: Computer Science
Write a java program creating an array of the numbers 1 through 10. Shuffle those numbers.
Randomly pick a number between one and ten and then sequentially search the array for that number.
Once the number is found, place that number at the top of the list.
Print the list. Perform #3 thru #5 ten times.
In: Computer Science
A. What can happen if pointer is uninitialized. Explain the concept
and what should ideally be done
in such case
B. Memory was allocated initially for 5 elements,
later on two more elements added to list. How can
space be managed in such case. Implement the scenario in C.
In: Computer Science
In: Computer Science
Consider the following three tables, primary and foreign keys.
Table Name SalesPeople
Attribute Name Type Key Type
EmployeeNumber Number Primary Key
Name Character
JobTitle Character
Address Character
PhoneNumber Character
YearsInPosition Number
Table Name ProductDescription
Attribute Name Type Key Type
ProductNumber Number Primary Key
ProductName Character
ProductPrice Number
Table Name SalesOrder
Attribute Name Type Key Type
SalesOrderNumber Number Primary Key
ProductNumber Number Foreign Key
EmployeeNumber Number Foreign Key
SalesOrderDate Date
Assume that you draw up a new sales order for each product sold.
Develop the following queries in SQL:
a. All the Sales People with less than four years in position.
b. All the Product Names sold on April 4th.
c. All the Products sold by Sales People less than 3 years in the position.
In: Computer Science
The program is not asking y/n :look below
Enter your grade:0.00
F
Continue (y/n)y
Enter your grade:3.33
B+
Enter your grade:
--------------------------------------------
def calci():
grade = float(input("Enter your grade:"))
while (grade <= 4):
if (grade >= 0.00 and grade <= 0.67):
print("F")
break
elif (grade >= 0.67 and grade <= 0.99):
print("D-")
break
elif (grade >= 1.00 and grade <= 1.32):
print("D")
break
elif (grade >= 1.33 and grade <= 1.66):
print("D+")
break
elif (grade >= 1.67 and grade <= 1.99):
print("C-")
break
elif (grade >= 2.00 and grade <= 2.32):
print("C")
break
elif (grade >= 2.33 and grade <= 2.66):
print("C+")
elif (grade >= 2.67 and grade <= 2.99):
print("B-")
break
elif (grade >= 3.00 and grade <= 3.32):
print("B")
break
elif (grade >= 3.33 and grade <= 3.66):
print("B+")
elif (grade >= 3.67 and grade <= 3.99):
print("A-")
break
elif (grade == 4.00):
print("A")
break
elif (grade == 4.00):
print("A+")
else:
print("Invalid input enter FLOAT only")
calci()
def main2():
question = input("Continue (y/n)")
if question == "n" or question == "N":
print("Bye")
elif question == "y" or question == "Y":
calci()
main2()
else:
print("Invalid Input-Enter either y or n")
main2()
print("ISQA 4900 quiz")
calci()
main2()
fix the errorIn: Computer Science
(Programming Language: Python)
It's trivial that the value of a number remains the same no matter how many zeros precede it. However, adding the zeros at the end of the number increases the value * 10. Jasmine is tired of seeing \001/100" on her tests (well yes, no one really writes 001, but Jasmine's teacher finds it funny to do so). So, she managed to login to her teacher's computer and now wants to design a function that can move the 0's in her grade to the end before her teacher uploads her grades. Although we don't agree with Jasmine's tactics, Krish (Jasmine's mentor) told us to help her out by finishing the `move zeros' function. This function should move all the 0's in the given list to the end while preserving the order of the other elements.
Remember that this function needs to modify the list, not return a new list!
---------------------------------------------
def move_zeros(lst: List[int]) -> None:
"""
Move all the 0's in lst to the END of the lst *in-place*, i.e. *modify* the list, DONT return a new list
>>> lst = [1, 0, 2, 3]
>>> move_zeros(lst)
>>> lst [1, 2, 3, 0]
"""
pass
In: Computer Science
Explain the bit-plain slicing ? Subject is digital image processing
In: Computer Science
1 Objective The purpose of this assignment is to test your familiarity with Java I/O, and if-else statements. Please submit your file as ”Shipping.java”
2 The Backstory Amazon.com wants to try out it’s new ‘Delivery by Drone” service and has recruited you to write a Java console application to calculate the shipping cost. They are going to charge the customer based on various criteria, as shown below:
| Weight (in kg) | Rate per 50 miles |
|
2 or less Over 2 Kg, up through 6 Kg Over 6 Kg, up through 10 Kg Over 10 Kg, up through 20 Kg |
$5.10 $10.18 $22.43 $40.60 |
Amazon Prime members get a 10% discount.
3 Specifications
• First, ask for the weight of the package (in kilograms). The user can enter this as a decimal number, so use type double. Values of 0 or less are invalid (i.e. a package has to weigh something). Do not accept weights of more than 20 Kg either, as this is the maximum weight the company will ship).
• If the user enters an invalid choice, print an appropriate error message and abort the program. (See sample outputs for error messages).
• Now ask the user to enter the distance to ship the package (in miles). This will be entered as an integer. 0 miles or less is considered invalid (must be a positive distance to ship). Also, do not accept distances of more than 3000 miles - consider 3000 miles to be the company’s maximum shipping distance.
• If the user enters an invalid choice, print an appropriate error message and abort the program. (See sample outputs for error messages).
• For a valid weight and distance, compute the shipping charges according to the chart above, noting that ”rate per 50 miles shipped” means that anything up to 50 miles is at the 50 mile rate, anything above 50 up to 100 miles is at the 100 mile rate, and so on.
• Ask if the user is an Amazon Prime member. If the user says Yes, give them a 10% discount.
• Print out the following results: – The package weight (default format), in kilograms. – The shipping rate for this package, to 2 decimal places, (money format). – The number of miles chosen. – The calculated shipping cost, to 2 decimal places (money format).
• See the Sample Runs below for expected output messages and numerical output formats.
• Also note: The System library has a method called exit(), which will cause a program to terminate immediately. It requires a parameter - usually, it is sufficient to just pass in the value 0
4 Sample Runs
Sample Run 1:
Welcome to Amazon Shipping Calculator
Please enter the weight of the package, in Kg: 19.4
Please enter the distance to be shipped (in miles): 2318 Are you an Amazon Prime member? (Yes/No): No
Package weight = 19.4 Kg Shipping rate = $40.60 per 50 miles Number of miles = 2318
Total shipping charges = $ 1908.20
Goodbye
Sample Run 2:
Welcome to Amazon Shipping Calculator
Please enter the weight of the package, in Kg: 8.4 Please enter the distance to be shipped (in miles): 134
Are you an Amazon Prime member? (Yes/No): Yes
Package weight = 8.4 Kg Shipping rate = $22.43 per 50 miles Number of miles = 134
Total shipping charges = $ 60.56
Goodbye
Sample Run 3 (error case): Welcome to Amazon Shipping Calculator
Please enter the weight of the package, in Kg: -5 Invalid package weight. Program aborted
Sample Run 4 (error case): Welcome to Amazon Shipping Calculator
Please enter the weight of the package, in Kg: 21.8 Cannot accept packages over 20 Kg. Program aborted
In: Computer Science