Podcast
Questions and Answers
What is the maximum size of notes allowed during the exam?
What is the maximum size of notes allowed during the exam?
Which of the following programming constructs is used for repeated execution of a block of code in Java?
Which of the following programming constructs is used for repeated execution of a block of code in Java?
In Java, which operator is used for integer division?
In Java, which operator is used for integer division?
Which statement correctly represents the use of a try-catch block in Java?
Which statement correctly represents the use of a try-catch block in Java?
Signup and view all the answers
What will be the output of the following code if the user enters 5, 3, and 0 in sequence: 'Scanner input = new Scanner(System.in);int number;int max = 0;while ((number = input.nextInt()) > 0) { if (number > max) { max = number; }} System.out.println(max);'?
What will be the output of the following code if the user enters 5, 3, and 0 in sequence: 'Scanner input = new Scanner(System.in);int number;int max = 0;while ((number = input.nextInt()) > 0) { if (number > max) { max = number; }} System.out.println(max);'?
Signup and view all the answers
Which of the following is a valid way to declare an ArrayList in Java?
Which of the following is a valid way to declare an ArrayList in Java?
Signup and view all the answers
What is the purpose of Javadoc in Java programming?
What is the purpose of Javadoc in Java programming?
Signup and view all the answers
Which of the following statements about flowcharts is accurate?
Which of the following statements about flowcharts is accurate?
Signup and view all the answers
What will happen if the user enters a negative number when prompted for positive integers?
What will happen if the user enters a negative number when prompted for positive integers?
Signup and view all the answers
What is the initial value of 'max' used for in the scanner input program?
What is the initial value of 'max' used for in the scanner input program?
Signup and view all the answers
In the factorial program, what happens if the user inputs a negative integer?
In the factorial program, what happens if the user inputs a negative integer?
Signup and view all the answers
Which of the following correctly represents the calculation of factorial in the provided program?
Which of the following correctly represents the calculation of factorial in the provided program?
Signup and view all the answers
What is the function of the loop in the factorial program?
What is the function of the loop in the factorial program?
Signup and view all the answers
Why should the program check if 'max' is equal to 0 after the loop?
Why should the program check if 'max' is equal to 0 after the loop?
Signup and view all the answers
If the user inputs N=5 for the factorial program, what is the expected output when the program runs?
If the user inputs N=5 for the factorial program, what is the expected output when the program runs?
Signup and view all the answers
What type of loop is suggested for printing a square of characters in the 'squarePattern' method?
What type of loop is suggested for printing a square of characters in the 'squarePattern' method?
Signup and view all the answers
Study Notes
Exam 2 Review - COMP 1000
-
Format:
- Exam II is similar to Exam I.
- Students get one 8.5x11" sheet of paper for notes.
- Notes can be written on both sides.
- No calculators, books, laptops, phones, headsets, smartwatches allowed, only the single page of notes.
- Exam will include multiple-choice/multiple select/true/false, explaining programs/parts, translating math to Java, writing and debugging code, fill-in-the-blank, and short answer questions.
-
Content:
- Input and output (Scanner and Print)
- Exceptions, try-catch, try-with-resources, hasNext()
- Mathematical expressions in Java (order of operations, integer division, etc.)
- if-else, switch-case statements
- while, do-while, and for loops
- Flowcharts and Control flow
- Methods and scope
- Javadoc, git, eclipse, general computing concepts
- Arrays and ArrayLists
- Reading Files with Scanner (first part of File I/O)
-
Review Exercises:
- Exercises may not be the same format as the exam.
- Provided practice exercises to help with question style, and complexity.
- Exam 1 review or previous exam slides also helpful.
-
Example Exercises and Answers:
- A program reading positive integers and printing the highest.
- A program to calculate N! (factorial)
- A method to calculate gravitational force between two bodies.
- Use formula F = Gm1m2/d2
- G = 6.673 x 10^-11
- Pass mass (m1, m2) and distance (d) as arguments.
- Program to read 10 integers and print in reverse order using an array.
-
Additional Problems:
- Additional exercises are available for further study.
- Implement the questions from the Day of the specific class.
-
Additional Information:
- Students need to review all covered material for the semester.
- To prepare for an exam, go through the provided examples and exercises.
- Review the notes, and the provided programming examples.
- Additional help is available during or after the class.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Prepare for your Exam II in COMP 1000 with this comprehensive review covering essential concepts such as input/output, control flow, methods, and data structures in Java. The exam format includes various types of questions that will test your understanding of the material. Use this quiz to assess your knowledge and strengthen your skills before the test.