CSC 142 Exam #1 Spring 2020 1.) What kind of code does the Java compiler produce as its output? 2.) (T/F) It is possible to build a computer that does not use electricity at all. 3.) What...

1 answer below »


CSC 142 Exam #1 Spring 2020



1.) What kind of code does the Java compiler produce as its output?






2.) (T/F) It is possible to build a computer that does not use electricity at all.




3.) What number in hexadecimal is equivalent to the binary number 11100111?








4.) What is 01B2 in decimal? (show your work)








5.) Which of the following is the correct syntax to output a message?


a.) System.println(Hello, world!);


b.) Out.system.println"(Hello, world!)";


c.) System.println.out('Hello, world!');


d.) System.out.println("Hello, world!");


e.) System.println("Hello, world!");



6.) (T/F) Java Byte Code that has been compiled on a Windows 10 machine with an AMD Ryzen 9 3950X CPU should run just fine on an MacBook Pro with a Core i7 CPU.







7.) Which of the following are

valid

identifiers in java?


A.) Object#Count


B.) $money


C.) Late_Fee


D.) __$__




8.) (T/F) A Java
applet
is a stand-alone program that does not require a web browser.




9.) Matching:



A.) A group of 4 bits 1.) decimal


B.) Base-10 numbering system 2.) binary


C.) Base-16 numbering system 3.) nibble


D.) Base-2 numbering system 4.) hexadecimal


E.) A group of 8 bits 5.) byte




10.) (T/F) A
class
must be defined before you can call a method of that class.




11.) Suppose you have an application that manages the inventory of an auto dealership. A field is defined, “vehicleCount”, which contains the total number of vehicles in stock. Should this field be implemented as a
class
data value, or an
instance
data value?







12.) Draw an inheritance diagram for the classes: Animal, Cat, Dog, Cow.










13.) Which of these identifiers
obey
the naming
convention
for object names? (all of these are
legal
identifiers, I am asking about the object naming convention)



a.) Isthisokay


b.) goodName


c.) C3PO


d.) ThisIsReallyOkay


e.) areallygreatname


f.) anotherBadOne









14.) (T/F) A subclass may be defined to inherit from two superclasses.








15.) Draw the arrows for the state-of-memory diagram after the following code has executed. Put an X through any references that are no longer valid. :



String one = new String (“Moe”);



String two = new String (“Larry”);



String three = new String (“Curly”);



three = one;



one = two;



two = three;





one two three










































String String String














16.) (Multiple Choice) In the statement ‘System.out.println();’ , what is ‘System’? (choose one answer only)



a.) An object


b.) An argument


c.) A method


d.) A class





17.) What is the value of the following expressions? Make sure to give a value of the appropriate type (such as including a .0 at the end of a
double)



a.)

41 % 7 * 3 / 5 + 5 / 2 * 2.5




b.)
2 + 19 % 5 - (11 * (5 / 2))






18.) List the 6 primitive numerical data types in Java:






19.) What reserved word do we use to create an object in Java?




20.) The 3 types of comments in Java are: Single line comments, Multiple line comments, and __________________________.




21.) If Class A inherits from Class B, which is the superclass?






22.) What part in a computer contains the ALU?




23.) Find the 3 errors in the following code fragment:



class 1JavaTest{



public static void main (String] args){



myString String;



myString = new String(“Enter your Student ID: ”);



System.out.println(String);



}


}








24.) Write all the code for a class RadiationSample. There are only 2 fields in this class, a String that contains the date and time that the sample was logged, and a field that holds the number of counts per minute recorded, for that date and time. (the format of the date and time within the String does not matter, for this problem.)



The values for the date/time String, and the number of counts per minute are set in the constructor, so there are no “set” methods in the class. There are 2 “get” methods, one to return the String, and one to return the number of counts per minute.















25.) (Extra Credit-2 pts) Another numbering system used in computer science is
octal, or base-8.



What is the decimal (base 10) equivalent of 172 in octal? (show your work)

Answered Same DayMay 13, 2021

Answer To: CSC 142 Exam #1 Spring 2020 1.) What kind of code does the Java compiler produce as its output? ...

Neha answered on May 13 2021
144 Votes
1) What kind of code does the Java compiler produce as its output?
The java code produces java class as the output for
java compiler code.
2) It is possible to build a computer that does not use electricity at all.
True
3) What number in hexadecimal is equivalent to the binary number 11100111
E7
4) What is 01B2 in decimal?
Ans: 434
Converting hexadecimal to binary: 110110010
Binary to decimal:
(01B2) ₁₆ = (0 × 16³) + (1 × 16²) + (11 × 16¹) + (2 × 16⁰) = (434) ₁₀
5) Which of the following is the correct syntax to output a message?
System.out.println("Hello, world!");
6) Java Byte Code that has been compiled on a Windows 10 machine with an AMD Ryzen 9 3950X CPU should run just fine on an MacBook Pro with a Core i7 CPU?
Ans: True
7) Which of the following are valid identifiers in java?
$money
8) A Java applet is a stand-alone program that does not require a web browser.
True
9) Matching
A.) A group of 4 bits - Byte
B.) Base-10 numbering system - Decimal
C.) Base-16 numbering system - Hexadecimal
D.) Base-2 numbering system - Binary
E.) A group of 8 bits – nibble
10) A class must be defined before you can call a method of that class.
True
11) Suppose...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here