100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
EECS 132 Final Exam New Generation 2023 Questions and Answers with complete solution $12.49   Add to cart

Exam (elaborations)

EECS 132 Final Exam New Generation 2023 Questions and Answers with complete solution

 2 views  0 purchase
  • Course
  • Institution

EECS 132 Final Exam New Generation 2023 Questions and Answers with complete solution What is a data type? What kind of data that a value represents - It is either specified by the programmer or by the rules of the programming language - every piece of data has an unambiguous type - there are...

[Show more]

Preview 2 out of 15  pages

  • August 12, 2023
  • 15
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
EECS 132 Final Exam New Generation 2023 Questions
and Answers with complete solution
What is a data type?
What kind of data that a value represents
- It is either specified by the programmer or by the rules of the programming language
- every piece of data has an unambiguous type
- there are two kinds of types in Java: primitive and non-primitive
What is a typecast? How is it different for when typecasting objects?What things
are similar?
- Typecasting a primitive type converts a value of one type into a value of a different
type
- Typecasting a non-primitive type changes how you can use that variable, but it does
not change the location in memory
- Typecasting a non-primitive type means that the methods and fields you can access
change depending on what you have typecasted to
- The way in which you typecast is the same
- For compound types, automatic typecasting occurs when you go from a lower to a
higher place in the hierarchy; for primitive types, it is automatic when you go from a
narrower type to a wider type
You can typecast (convert) between all primitive types except ____.
boolean
T/F: You cannot typecast between primitive and compound types
T
How do you typecast?
- you place the desired type in parentheses and immediately to the left of the
value(desired-type)value
When are typecasts done automatically?
Values are automatically converted from narrower to wider types
When must a typecast be explicit?
When you are converting from a "wider" type to a "narrower" type
List the primitive types in Java from widest to narrowest
1. double
2. float
3. long
4. int
5. short/char
6. byte
Generally, when converting to a wider type, Java converts the value to as ____ as
possible to the original value.When converting to a narrower type, Java generally
____ the value.
- close
- truncates
What is a primitive type? How many primitive types are there in Java?

, - types already predefined in Java
-8
1. int
2. double
3. float
4. long
5. short
6. boolean
7. char
8. byte
What is a non-primitive/compound type in Java?
A type that is both pre-defined and programmer defined; It can be made of primitive
types and other compound types
What are the differences between primitive and compound types?
- primitive types:
1. the value of the type is the binary representation of the value
2. There are specifically 8 of them and they are pre-defined in Java
- compound:
1. the value of the type is the location of the instance in memory
2. There are an endless amount and can be either pre-defined or programmer-defined
3. A basic compound type is called a class, which consists of variables of any type,
methods that take 0 or more inputs + possibly perform some action + return 0 or 1
value, and other reference/compound types
How exactly are int's, double's, char's, and boolean's represented? Why does a
programmer need to know this?
1. int: is an integer or whole number
2. double: is a number with a decimal point or in scientific notation
3. char: represents a character of text
- are represented as single characters with single quotes surrounding them
- Ex.: 'a', '1', etc.
4. boolean: represents either true or false
**A programmer needs to know this because Java is a "strongly typed language".
Therefore, if they use a type incorrectly, not only is it hard to understand your code
because the type you used to represent your data does not make sense, but the
smallest error in assigning types or using types will mean your code may not work
How is arithmetic on a computer different from "real" arithmetic?
- Mathematics in Java ≠ real mathematics b/c errors will crop up due to the fixed size of
the numeric data types that would not appear if we were using real mathematics
- in Java, numbers are represented in binary, therefore some fraction numbers (like
3/10) cannot be represented exactly
What is the difference between "=", "==", and equals?
1. "=": assignment operator
- returns the value stored in that variable
- assigning a location in memory
2. "==": equality operator
- result is boolean

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller magdamwikash23. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $12.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

78462 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling

Recently viewed by you


$12.49
  • (0)
  Add to cart