def main(): i = 20 b = mysteriousFunction2 (i) print(b + i) def mysteriousFunction1(i): n=0 while n * n <=i : n+= 1 return n - 1 def mysteriousFunction2(a): b=0 for n in range(a): i = mysteriousFunction1(n) b=b+i return b main()
Q: Indices can speed up query processing, but it's usually a terrible idea to index every attribute,…
A: Query Processing: High-level queries are converted into low-level expressions during query…
Q: What is the difference between an SSL connection and an SSL session?
A:
Q: Write a C program called writer.c. It uses system call I/O to create a file called list1.txt which…
A: Please find the answer below :
Q: What is software life cycle model.?
A: Software life cycle model:- An explanation and diagrammatic depiction of the software life cycle is…
Q: a. Calculate the latency (in msec) required to send the 1500byte packet from Host A to Host B
A: Please check the solution below
Q: Hi! Can you make it two classes? The Calculator class must instantiate the CalculatorFrame class and…
A: The java program is given below:
Q: Verilog Question Lets say i have a module that outputs a 32 bit number. I want to grab bits 8-14 or…
A: Verilog is used to simplify the process and make the Hardware Description Language (HDL) more robust…
Q: 1) Build a matrix called A consists of multidimensional arrays. This matrix contains three layers;…
A: Here is the matlab code of the above problem. See below steps.
Q: Parsing and Ambiguity 1) Let G be the context-free grammar with productions S -> aSaa | B, B ->…
A: According to the information given:- We have to draw a parse tree for a3b3c3a6 and define whether G…
Q: What would be introduced as criteria of a table being in first normal form? a.) There should be no…
A: First Normal form:- A relation in a relational database has a property called first normal form…
Q: What is test case generation case tool?
A: Introduction The point of testing is to track down bugs in a framework or application.
Q: Write a program in java using two dimensional arrays. You should prompt the user to enter the number…
A: The java program is given below:
Q: Write a scenario or situation that shows attacks that affected a system, then suggest Security…
A: A system user received a ransom note informing them that their files had been encrypted. The note…
Q: Explain the role of email in investigations. Describe client and server roles in email. Describe…
A: 1) Email is used in forensic analysis to study the source and content of e-mail message as evidence,…
Q: What is software life cycle model.?
A:
Q: Question: The store owner sends a binary bitstream to the store manager after a request from the…
A: Convert the given bit stream to Base64 The owner sends this bitstream to the manager: 00100 10001…
Q: Which of the following ALTER TABLE features is available in SQLite? DROP COLUMN ALTER COLUMN…
A: This question comes from Database Management System which is a paper of Computer Science. Let's…
Q: What is the purpose of HTTPS?
A: HTTPS)Hypertext Transfer Protocol Secure is a secure version or extension of HTTP. This protocol is…
Q: Exercise 4A Write functions to perform the following tasks efficiently. Do not change the function…
A: Code Output
Q: ✔ Checkpoint: split Write a method called split that takes a Set of strings as a parameter and…
A: Answer:
Q: You are given an array of n integers. Write a java method that splitsthe numbers of the array into…
A: Answer the above program are as follows
Q: Assume that you are in charge of designing a fiber optic telecommunication system for sending an…
A:
Q: Consider this scenario: A nurse in the hospital has been assigned to provide daily care to her…
A: Answer:
Q: We know using a longer key for symmetric encryption is more secure than using a shorter key. For…
A: The question is to explain why we don’t use even longer keys for stronger encryption.
Q: In your own words, describe/explain the advantages of Threat Modeling and Intelligence gathering
A: Advantages of Threat Modeling: So how else can threat modeling help your security team and what else…
Q: What is software engineering?
A: The answer to the question is given below:
Q: How do graphic designers use the following in the working place 1. Writing text 2. Critical thinking…
A: The graphic designer uses the above following in the work place.
Q: 35 to 40.
A: We know Class is a user-defined data type that encapsulates the variables and methods. as we know An…
Q: Parsing and Ambiguity 1) Let G be the context-free grammar with productions S -> aSaa | B, B ->…
A: According to the information given:- We have to draw a parse tree for a3b3c3a6 and define whether G…
Q: Write an assembly program (Data and Code) that read and swap two numbers, and output them after…
A: Answer: We have done code in Assembly Language and also attached the codes well as output
Q: Write a C program that will display text on any terminal. The program should first prompt the user…
A: CODE(Find explanation in comments): // C program to write user input to terminal…
Q: This program requires the student to create a programming loop. The program's loop with loop between…
A: #include<stdio.h> int main() { int no_of_weeks,i=1; /* variable declaration */ float…
Q: write operations of fuzzy set.
A:
Q: Searching and Sorting 4.Write the algorithm of Merge Sort in brief and show the steps of sorting…
A: The question has been answered in step2
Q: Q4: Each of the following hexadecimal numbers can be interpreted as representing a decimal number or…
A: Considering all the given numbers to be representing decimal numbers. 1. 435316 = 4*163 + 3*162 +…
Q: Question 1: Mark T or F in front of the following statements. 1. A compound statement is a single…
A: A compound statement : A compound as the name suggest is the type of statement that consist of more…
Q: What is evolutionary model? Write its applications and advantages.
A: In software development, the evolutionary model is a model of the software development process where…
Q: Exercise 1-Printing Characters of Odd ASCII Codes Recursively Exercise Objectives ✓ Calling…
A: We need to write a function for the given scenario. Programming language used is C.
Q: Which of the following is a key part of conceptual design in an entity relationship model? This…
A: Here is explanation regarding entity relationship model.
Q: List TWO (2) advantages of using systems analysis and design techniques in approaching computerized…
A: The significance of system analysis is additionally clear by they way it assists with cash the…
Q: exam: Write program for read matrix x(4,4) then replace the first part of matrix with the fourth…
A: I have written the code and output below:
Q: can u do it without using string
A: Please find the answer below :
Q: combination of attributes, that could be used as a search key?
A: The answer is
Q: explain the notion of measuring a doubly linked list's performance? Does time complexity come into…
A: We need to explain the notion of measuring a doubly linked list's performance.
Q: c) "Each of the 93 students in this class owns a personal computer. Everyone who owns a personal…
A: The question is to find the rule of inference for each step.
Q: List and briefly define the parameters that define an SSL session connection.
A: Answer: We need to write the define the SSL session connection and its parameter. so we will see in…
Q: Order of tuples in a table is irrelevant, true or false?
A: Multiple items can be stored in a single variable by using tuples.
Q: te Java Code to perform the following search algorithms 1. Linear Search 2. Binary Search On the…
A: import java.util.Arrays; public class Test{public static void main(String[] args) {int[] ar =…
Q: Develop program of Euler method for solving the following differential equation = x³ + y with…
A: Below I have provided a program for the given question. Also, I have attached a screenshot of the…
Q: Find the Binary Representation for each of the following Decimal numbers 1. 10 2. 53 3. 85 4. 4.48
A: According to the information given:- We have to define binary representation for each of the…
. Given the following code, what is the output
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- For any element in keysList with a value greater than 50, print the corresponding value in itemsList, followed by a comma (no spaces). Ex: If the input is: 32 105 101 35 10 20 30 40 the output is: 20,30, mport java.util.Scanner; public class Compare { public static void main(String args[]) {final int SIZE_LIST = 4;int[] keysList = new int[SIZE_LIST];int[] itemsList = new int[SIZE_LIST];int i;Scanner input = new Scanner(System.in); keysList[0] = input.nextInt();keysList[1] = input.nextInt();keysList[2] = input.nextInt();keysList[3] = input.nextInt(); itemsList[0] = input.nextInt();itemsList[1] = input.nextInt();itemsList[2] = input.nextInt();itemsList[3] = input.nextInt(); /* Your code goes here */ System.out.println();} }8.Coding below srason 1 two ir more Questionimport java.util.* ; public class MaxFinder{ public static void main(String[] args) { //average high temperatures for Toronto according to gocanada. String temperatures = "-2 -1 4 11 18 24 27 26 21 14 7 0" ; Scanner scanner = new Scanner(temperatures) ; int hottestTemp = 0 ; int hottestMonth = 0 ; int coldestTemp = 0 ; int coldestMonth = 0 ; //-----------Start below here. To do: approximate lines of code = 14 // 0. initialize month //1. write a while loop that reads temperatures from scanner (assume you do not know how many values there will be, so use the hasNextInt() method) ; // Hint: use scanner.hasNextInt() in the loop condition // Don't forget to increment variable month //2. if this is the first month or an extreme month, update the hottestMonth,hottestTemp or coldestMonth,coldestTemp variables ; // an extreme month means the temperature for this month is > the…Lab2.java contains the following code: public final class Lab2 { /** * This is empty by design, Lab2 cannot be instantiated */ private Lab2() { // empty by design } /** * Returns the sum of a consecutive set of numbers from <code> start </code> to <code> end </code>. * * @pre <code> start </code> and <code> end </code> are small enough to let this * method return an int. This means the return value at most requires 4 bytes and * no overflow would happen. * * @param start is an integer number * @param end is an integer number * @return the sum of start + (start + 1) + .... + end */ public static int sum(int start, int end) { //Insert your code here and change the return statement to fit your implementation. return 0; } /** * This method creates a string using the given char * by repeating the character <code> n </code> times. * * @param first is…
- import java.util.Scanner;public class LabProgram{ static boolean IsArrayMult10(int inputVals[],int numVals) { for(int i=0;i<numVals;i++) { if(inputVals[i]%10!=0) return false; } return true; } static boolean IsArrayNoMult10(int inputVals[],int numVals) { for(int i=0;i<numVals;i++) { if(inputVals[i]%10!=0) return true; } return false; } public static void main(String[] args) { int n; boolean f=false; Scanner sc= new Scanner(System.in); n=sc.nextInt(); int []arr=new int[20]; if(n<=20) { for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } } if(IsArrayMult10(arr,n)==true) System.out.print("all multiples of 10\n"); if(IsArrayNoMult10(arr,n)==true) { for(int i=0;i<n;i++) { if(arr[i]%10==0) { f=true; break; } } if(f==true)…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 - 3. Given the following code, the output is __. class Base { private int x = 5; }class Derived extends Base { x = 6; }public class Sample { public static void main(String[] args) { int x = 7; Derived d1 = new Derived(); System.out.print(d1.x); }} A. 0B. 5C. 6D. 7E. Error message Part 2 - 4. A class Animal has a subclass Mammal. Which of the following is true? A. class Animal extends Mammal { }B. class Mammal extends Animal { }C. class Animal implements Mammal { }D. class Mammal implements Animal { }E. class Mammal { Animal a1 = new Animal(); }*in java* Write a loop that subtracts 1 from each element in lowerScores. If the element was already 0 or negative, assign 0 to the element. Ex: lowerScores = {5, 0, 2, -3} becomes {4, 0, 1, 0}. import java.util.Scanner;public class StudentScores {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);final int SCORES_SIZE = 4;int[] lowerScores = new int[SCORES_SIZE];int i; for (i = 0; i < lowerScores.length; ++i) {lowerScores[i] = scnr.nextInt();} /* Your solution goes here */ for (i = 0; i < lowerScores.length; ++i) {System.out.print(lowerScores[i] + " ");}System.out.println();}}
- Scylla or Charybdis? def scylla_or_charybdis(moves, n): This problem was inspired by the article "A Magical Answer to the 80-Year-Old Puzzle" in Quanta Magazine. Thanks to your recent cunning stunts, your nemesis in life is trapped inside a devious game where, for a refreshing change from the usual way of things, you get to be the Final Boss. (Everyone is the hero in their own story until they become a villain in somebody else's, after all.) This final level is a one-dimensional video game platform that reaches n-1 steps from its center to both directions. At each end of this platform exactly n steps away from the center, your two lethal friends Scylla and Charybdis are licking their lips in anticipation of a tasty morsel. Your nemesis starts at the center of this platform. To start this deadly combat of wits, she must immediately commit to her entire sequence of future moves, given to this function as a string of characters '+' (“� just a step to the ri-i-i-i-ight � ”) and '-' (move…**JAVA LANGUAGE** beginner level import java. util.Arrays;import java.util.Scanner; Suppose that a Scanner object contains a bunch of tokens all on a single line separated by spaces. For example: 100.5 30.4 pizza 56.8 1000.3 8.2 Also suppose that you have a particular item that you know the price of. Let’s use the following example: Kindle: 99.99 Write a static method: public static double priceIsRight(Scanner s, double price) that takes a Scanner and an item price as parameters and returns the bid that is closest to the item price but not greater than the item price. If all bids are greater than the price, return 0.0. If there are no bids (Scanner is empty) return 0.0. You can assume the Scanner is not null. In the above example. 56.8 should be returned, since it is the number that is closest to 99.99 but not over 99.99. Notice that there may be some invalid tokens in the Scanner's input. The above example has pizza as one of its tokens, which is clearly not a valid bid. Your…import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int n = scnr.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = scnr.nextInt(); } for (int i = n - 1; i >= 0; i--) { System.out.print(arr[i]); if (i > 0) { System.out.print(","); } } }}
- Create a graphical JAVA program that simulates a simple arcade game (like Frogger) using the ACM graphical package. an example is written below. import acm.program.*;import java.awt.Color;import acm.graphics.*;import java.util.Random;import java.awt.event.KeyEvent; public class Frogger extends GraphicsProgram { GLabel gover = new GLabel("GAME OVER ", 50, 60);GImage[] car = { new GImage("car.png", 0, 145), new GImage("car.png", 200, 145), new GImage("car.png", 400, 145) };GImage frog = new GImage("frogsmall.png", 200, 325); public static void main(String[] args) {Frogger game = new Frogger();game.start();} public void drawImage() {for (int i = 0; i < car.length; i++) {add(car[i]);}add(frog); } public void run() { setBackground(Color.GREEN);// tell program to listen for keyboard eventsaddKeyListeners(); //set up game over labelgover.setColor(Color.RED);gover.setFont("Arial-30"); drawRoad();drawRoadMarkers();drawImage(); while (true) {// for every car in the arrayfor (GImage…Code 16-1 /** This class has a recursive method. */ public class EndlessRecursion { public static void message() { System.out.println("This is a recursive method."); message(); } } Code 16.2 /** This class has a recursive method message, which displays a message n times. */ public class Recursive { public static void messge (int n) { if (n>0) { System.out.println (" This is a recursive method."); message(n-1); } } } Task #1 Tracing Recursive Methods 1. Copy the file Recursion.java (see Code Listing 16.1) from the Student Files or as directed by your instructor. 2. Run the program to confirm that the generated answer is correct. Modify the factorial method in the following ways: a. Add these lines above the first if statement: int temp; System.out.println("Method call -- " + "calculating " + "Factorial of: " + n); Copyright © 2019 Pearson Education, Inc., Hoboken NJ b. Remove this line in the recursive section at the end of the method: return…Class Die java.lang.Objectextended by Diepublic class Dieextends java.lang.ObjectDie - an n-sided die with given integer values. The given integer values are returned via nextRoll() with uniform probability., Constructor SummaryDie() Creates a new Die instance with the default values: 1, 2, 3, 4, 5, 6.Die(int[] outcomes) Creates a new Die instance with the given integer outcomes.Die(int sides, int min) Creates a new Die with a given number of sides and an incremental sequence of values beginning with a given minimum value.Method Summaryint nextRoll() nextRoll - return one of the die values at random.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitConstructor DetailDie public Die(int[] outcomes)Creates a new Die instance with the given integer outcomes.Parameters:outcomes - an int[] value - an array of the integer values for each side of the die.Die public Die(int sides,int min)Creates a new Die with…