[Solved] SOLVED:CIS 5100 Data Structures and Programming (Java) Midterm Exam

30 $

File Name: SOLVED:CIS_5100_Data_Structures_and_Programming_(Java)_Midterm_Exam.zip
File Size: 631.14 KB

SKU: [Solved] SOLVED:CIS 5100 Data Structures and Programming (Java) Midterm Exam Category: Tag:

Or Upload Your Assignment Here:


1. A (5 points) Define the term “algorithm”.B (5 points) What is UML?What is it good for?

C (3 points) Write aprogram that decides whether integer number input1 can be divided by integernumber input2 without remainder. Theprogram should output “No Remainder” if there is no remainder and “Remainderis: ” if there is any. In this lattercase, the program should output the value of the remainder as well.D (6 points) Writea program line that generates the following stream output2. A(6 points) What is compilation?

What does thecompiler do? (Explain with your ownwords.)

B (7 points) How manycontrol statements does Java have?

There are 7 controlstatements in Java:Name the control statementsof Java.

Give at least 1example for each.

C (5points) Draw an activity diagram for thefollowing piece of code:

D (8 points) Writea FOR loop that sums even integers from 4 through 54 ANDprints out the FINAL result only.3. A (3points) Write a piece of code in Java thatsets the value of “int Number” randomly from the following set: {404, 405, 406, 407, 408}.B (5 points) Write a program segment in java thatsets the value of “int Number” randomly from the following set: {404, 405, 406, 407, 411}. !

C (11 points)Pythagorean Triples. The set of three integer values for thelengths of the sides of a right triangle is called a Pythagorean Triple. These three sides must satisfy therelationship that the sum of the squares of two of the sides is equal to thesquare of the hypotenuse.

Specifically:

a*a + b*b = c*c

is true if andonly of the triangle is a right triangle.

Write a method thatgets 3 input integers and checks whether those in any order represent aPythagorean Triple. The method returns‘p’ if the numbers are of Pythagorean Triples and returns ‘n’ otherwise.D (11 points)Write a program that prints out primesin a decreasing order between 1 and 59.(1 is considered to be a prime here.)4. A (7 points) Anenhanced for statement loops through an array. The syntax is for ( parameter : arrayName ) statement

How would you use aregular forstatement to replace an enhanced one

Draw theactivity diagram of the enhanced for. (Parameter goes in order for firstto last, no index needed)B (7 points)Write a program that prints thefollowing array’s values in descending order

C (7 points) Apalindrome is a number or text phrase that reads the same backwards asforwards. For example, each of thefollowing five-letter words is a palindrome: abcba, ghihg, bbbbb.

Write a program containing a method thatdetermines whether a five-digit word is a palindrome.D (4 points)What does the following program do? Explainline-by-line and then give the output.ClickBUY NOW BUTTON For Solution

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:CIS 5100 Data Structures and Programming (Java) Midterm Exam
30 $