CMSC 255 : INTRO TO PROGRAMMING FINAL (CHAPTER 1 - 12) QUESTIONS AND ANSWERS, RATED A+| latest update 2024/25|
CMSC 255 : INTRO TO PROGRAMMING FINAL (CHAPTER 1 - 12) QUESTIONS AND ANSWERS, RATED A+ Which of the following lines of code correctly writes "Hello" to the screen? - - Sln("Hello"); Fill in the blanks in the main method code below: - -public static void main (String[] args) The class name does not have to be the same as the filename in a Java program. - -false The command to compile a Java program is: [a] H. - -javac Logic errors are the hardest errors to find. - -true While running a program, it unexpectedly stops. What type of error is that? - -runtime What does the virtual machine do? - -runs byte code AND runs the class file Explain the steps that need to happen to take code from it being written to it running and producing output. - -1. The first step is to write a detailed pseucode for the code. 2. The second step is to make sure that the first letter of the class name is capitalized. (ex. public class Quiz_1) 3. The third step is to write the main method after writing the class name. 4. After the main method is written you need to assign an appropriate variable needed to compute the output. 5. After assigning the variable you need to let the compiler know what is it that you're trying to do. 5. The final step is to display the output to the screen which is done by Sln(" ") ; 6. Make sure your code compiles and runs properly. What is a variable? - -A variable is used to store data and and computation results in the program. Name two primitive Java data types that represent whole numbers. - -int, byte Name two primitive Java data types that represent floating-point numbers. - -double, float For each error shown below state if it is a compile-time error, run-time error, or no error: 1. ln("Greetings, Planet Earth!"); 2.Sln("Hello World!") distance = ; 4.Sln(50 / 0); 5.S(23 % 144); 6. Int x = 43; - -1. compile-time 2. compile-time 3. compile-time 4. run-time 5. no error 6. compile-time What is displayed in the following code segment
Written for
- Institution
- CMSC
- Course
- CMSC
Document information
- Uploaded on
- May 9, 2024
- Number of pages
- 21
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
cmsc 255 intro to programming final chapter 1
Also available in package deal