EE1301 - Fall 2023 - Quiz 2B - Take Home Portion

pdf

School

University of Minnesota, Rochester *

*We aren’t endorsed by this school

Course

5613

Subject

Electrical Engineering

Date

Feb 20, 2024

Type

pdf

Pages

1

Uploaded by HighnessFieldRat30

Report
Quiz 2B - Take-Home Part EE 1301 - Fall 2023 No interactions are allowed with anyone other than the professor. You may not take the exam in the same location as another student. Remember that academic dishonesty will result in a failing grade on the exam. In the past, a few people have tried to cheat and ended up failing. Don’t risk it! This portion of the quiz is open book and notes. You may use a calculator, computer, or any other electronic device. No communication with another intelligent being is allowed unless you programmed it. This exam is designed to take 30 minutes or less. You may work on this during the remainder of class or take it home and submit it before 10pm tonight. Create a single source code file named midterm_username.cpp and write the solutions to each problem into that file. As usual, replace username with your U of M Internet ID. Submit the single .cpp file containing all your solutions through Canvas before the deadline. Problem #10) _______/7 points Define a function that returns a random integer number. You must decide the purpose of the function. Explain in the comments the values your random number generator should generate, and why you chose the range(s) you did. Your function should match this function declaration. int rollDie(); Problem #11) _______/7 points Create a function isKindaPrime() that takes one integer argument and tests if the argument is evenly divisible by any of the numbers between 3 and 13 (inclusive). The function should return a boolean with the value false if none of the above numbers will evenly divide the argument, otherwise returns true . Problem #12) _______/7 points Create a main() function that calls your random number generator rollDie() to generate 10 integers and then tests each with isKindaPrime() . The program should then output each of the random numbers and report if it is KindaPrime with the following output format: Roll: 2 is KindaPrime Roll: 4 is not KindaPrime Roll: 17 is KindaPrime Problem #13) _______/3 points Follow good practices and coding guidelines as described in class. 1
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help