Fall 2024 CS 18000 Midterm Exam 1
32 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is a consequence of using an electronic device during the exam?

  • Your test will be taken and receive a zero. (correct)
  • You will receive a warning.
  • You can show your work to other students.
  • You will be allowed to continue the exam.
  • What items are permitted to be brought into the exam room?

  • Writing utensil and eraser. (correct)
  • Notes for reference.
  • Electronic devices for calculations.
  • Hat and jacket.
  • What should you do if your handwriting is deemed illegible?

  • Ask for a new exam paper.
  • You will receive a zero for that question. (correct)
  • Consult with the instructor.
  • Rewrite the question on a separate page.
  • Which statement is true regarding academic integrity during the exam?

    <p>Unauthorized help will lead to academic penalties.</p> Signup and view all the answers

    Which of the following is required at the top of every exam page?

    <p>Your username.</p> Signup and view all the answers

    What happens if you submit answers outside of the designated box?

    <p>They will not be scored.</p> Signup and view all the answers

    How does the exam instruct you to handle academic dishonesty?

    <p>It states violations will lead to academic penalties.</p> Signup and view all the answers

    What coding style considerations are emphasized during the exam?

    <p>Follow the course coding style.</p> Signup and view all the answers

    What is the return type of the deposit method in the AccountManager class?

    <p>boolean</p> Signup and view all the answers

    What should the deposit method do if an invalid account type is passed?

    <p>Return false and do nothing</p> Signup and view all the answers

    What happens if the deposit amount would cause the loan balance to become negative?

    <p>The method returns false</p> Signup and view all the answers

    Which prompt is used first to collect information from the user?

    <p>USERNAME_PROMPT</p> Signup and view all the answers

    How does the program respond if the user enters a negative number for the posts to view?

    <p>It displays the ERROR_MESSAGE</p> Signup and view all the answers

    What should the validateUsername method do?

    <p>Check if the username matches certain criteria</p> Signup and view all the answers

    What type of error is indicated by the ERROR_MESSAGE in the menu?

    <p>Invalid entry from user</p> Signup and view all the answers

    What will happen if the user input for number of posts is not an integer?

    <p>The program will print the ERROR_MESSAGE</p> Signup and view all the answers

    What type of post is displayed if the returned value from checkPostBrowsed() is divisible by both 3 and 5?

    <p>SPONSORED_CONTENT</p> Signup and view all the answers

    What is the output when calling primeFactorization(12)?

    <p>2 x 2 x 3</p> Signup and view all the answers

    Which of the following correctly identifies a condition under which to use a do-while loop?

    <p>When at least one iteration must execute regardless of condition.</p> Signup and view all the answers

    What would the correct printf statement be to print 'This course is fun 3.1 - 24' using the given variables?

    <p>printf(&quot;%s %.1f - %d&quot;, fun, x, y);</p> Signup and view all the answers

    What is the prime factorization of the integer 28?

    <p>2 x 2 x 7</p> Signup and view all the answers

    In the for loop iterating from i = 0 to x using Fibonacci increments, which of the following is a correct starting point for Fibonacci sequence values?

    <p>1, 1</p> Signup and view all the answers

    Which statement is true about the maximum size of any signed binary value of length n?

    <p>It is $2^{n-1} - 1$.</p> Signup and view all the answers

    To declare a string format as 'x hyphen y', which of the following initializations is correct?

    <p>String values = x + ' - ' + y;</p> Signup and view all the answers

    For which of the following integers is 22 represented in binary using Two's Complement Representation?

    <p>00010110</p> Signup and view all the answers

    What number is produced by the sum of factorials of the digits of 145?

    <p>145</p> Signup and view all the answers

    How can the statement 'Coding is easy.' be printed using the substring method with sOne and sTwo?

    <p>System.out.println(sOne.substring(2, 7) + ' is easy.');</p> Signup and view all the answers

    Which option incorrectly describes the condition for displaying FRIEND_POST?

    <p>The returned value must be divisible by 3.</p> Signup and view all the answers

    What is the correct declaration for a boolean variable isEven that checks the parity of myVar?

    <p>boolean isEven = (myVar % 2 == 0);</p> Signup and view all the answers

    Which of the following statements correctly initializes myVal as the sum of x and y where both are doubles?

    <p>int myVal = (int)(x + y);</p> Signup and view all the answers

    What is the correct condition for the while loop declaration checking if scan contains an integer?

    <p>while(scan.hasNextInt()) {</p> Signup and view all the answers

    What detail must be included in the constructor for AccountManager to set boolean values based on the type string?

    <p>The constructor must check each character in type string individually.</p> Signup and view all the answers

    Study Notes

    Exam Instructions

    • Total of 75 points; includes fill in the blank, short answer, multiple choice, and coding questions.
    • Submissions should follow academic integrity guidelines; no unauthorized help or resources.
    • Bring only writing utensil and eraser; no notes or electronic devices allowed.
    • All answers must be written in designated boxes; illegible handwriting will receive a zero.

    Code Tasks Overview

    • Use given variable types and initializations to write concise code.
    • Code tasks include printing formatted strings, using loops, declaring booleans, and initializing integers.
    • Tasks also require constructing classes and methods for banking-related functionalities, including deposit methods and prime factorization.

    Important Code Concepts

    • Printf Formatting: Use printf for formatted output; helpful for displaying numbers and strings.
    • Looping: Understand how to implement looping structures, such as for loops that utilize Fibonacci sequences.
    • String Manipulation: Utilize substring methods for extracting parts of strings.
    • Boolean Logic: Use boolean flags to determine the state of variables, especially in context of account management.
    • Class Design: Be familiar with creating constructors and methods within classes, especially managing multiple types of accounts.

    Class AccountManager

    • Constructor Requirement: Must take username and account type to determine account status.
    • Boolean Variables: Must be set based on whether accounts (checking, savings, loan) are active according to specified types.
    • Deposits: Implement deposits with conditions based on account type and balance checks.

    Infinite Menu Implementation

    • Input Handling: Continuously prompt for username and number of posts, validating entries.
    • Ensure to provide feedback for invalid entries and use predefined messages for user interaction.
    • Posts are displayed based on returned values categorized by their division properties.

    Mathematical Operations

    • Factorial and prime factorization must return string representations formatted correctly with specific separators.
    • Solve specific computational problems, such as identifying numbers that equal the sum of the factorials of their digits.

    Miscellaneous Knowledge

    • Understand binary representations, signed values, and their maximum and minimum size calculated by binary length.
    • Recognize specific cases favoring the use of do-while loops in programming.
    • Convert integers to binary in two's complement representation as part of exam tasks.

    Final Notes

    • Prepare to answer both theoretical questions around code behavior and practical coding challenges.
    • Familiarize yourself with best practices for writing clean, functional code within the time constraints of the exam.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Description

    Prepare yourself for the Fall 2024 CS 18000 midterm exam with this comprehensive practice quiz. It includes various question types such as fill in the blank, short answer, multiple choice, and coding questions. This practice exam is designed to help you review key concepts and perform well.

    More Like This

    CS 11 Final Exam Flashcards
    99 questions
    CS Excel Chapter 1 Practice
    50 questions
    CS 362 Software Development Phases
    32 questions
    Use Quizgecko on...
    Browser
    Browser