CSDS 123 Midterm

0.0(0)
Studied by 11 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/38

flashcard set

Earn XP

Description and Tags

Last updated 7:32 PM on 3/1/24
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

39 Terms

1
New cards

How is data represented on a computer?

All data is just numbers (bits 0’s and 1’s)

2
New cards

What is the type of a value?

what a piece of data represents

3
New cards

How does Java use types?

to store numeric values/ data

4
New cards

What are the rules Java uses to determine the types resulting from primitive operators?

Java automatically widens the narrower type then executes the expression.

5
New cards

Strongly Typed

every value in program has an unambiguous type

6
New cards

What are the differences between a value that is a primitive type and a value that is a non-primitive type?

Primitive type values are the data themselves

Non-primitive types reference memory location where the data is stored.

7
New cards

What is the purpose of a typecast?

convert data to different types

8
New cards

When are typecasts done automatically?

Typecasts are done automatically when going from a narrower to a wider type. This is called widening.

9
New cards

When must a typecast be explicit?

When going from a wider type to a narrower type. This is called narrowing.

10
New cards

When are typecasts illegal?

they violate the type compatibility rules (Ex: String to int)

11
New cards

How does a typecast affect a value of primitive type?

Typecasting temporarily changes the type of a value to the type casted

12
New cards

What is null?

a value that shows the object is referring to nothing

13
New cards

What is “short circuit evaluation“ and what operators use it?

Evaluation of a logical expression stops before a complete evaluation. (&& and ||)

14
New cards

What ways do a arithmetic on a computer differ from “real“ arithmetic

Errors will crop up due to the fixed size of the numeric data types

15
New cards

What are variables

A variable is a name given to a location in memory.

16
New cards

Difference between declaring and assigning a variable

  • Declaring creates a variable

  • Assigning assigns a value to an already created variable

17
New cards

Where can a variable be accessed?

Using expressions

18
New cards

How long does a variable exist

  • An instance variable exists as long as the class that it is in exists.

  • A local variable exists as long as the method that it is in also exists.

  • input parameters only exists until after the method that it is in is called.

19
New cards

What is the difference between static and non-static fields

  • Static variables are shared among all instances of a class

  • Non static variables are specific to that instance of a class

20
New cards

What is the difference between static and non-static methods

  • A static method is a class method and belongs to the class itself

  • non-static method is an instance method and belongs to each object that is generated from the class

21
New cards

What does public and private do

Public : can be accessed anywhere

Private: direct access only within this type

22
New cards

What does protected do

can be accessed by code in same folder or types that are protected

23
New cards

What does final do

means that the value, once set, will not change.

24
New cards

What are the parameters of a method and how do they work?

Takes input and utilizes them within methods

25
New cards

What is the return value?

values the function returns when it completes

26
New cards

method overloading

multiple methods/constructors of the same name as long as they have different inputs

27
New cards

method overriding

occurs when a subclass has the same method as the parent class

28
New cards

What is ‘this‘

refers to the current object in a method or constructor

29
New cards

What is super

refers to the superclass (parent) objects, used to call superclass methods

30
New cards

When is super() & this() used

  • super() can access the parent class constructor

  • this() can access current class constructor

31
New cards

What strategies should I use to test a method with a loop

JUnit, or creating tester methods

32
New cards

How do you create a string

String name = new String(“hello“) or String name = “hello“

33
New cards

How do you concatenate strings

Stringbuilder

34
New cards

What is a StringBuilder and when do we use it

Used when we want to modify a string without creating a new object

35
New cards

What can you change about a string after you create it

Nothing (String are immutatble)

36
New cards

What is an array

container object that holds a fixed number of values of a single type

37
New cards

How do you create an array

int intArray[] = new int[20];

38
New cards

benefits of a array

Very fast access to every elements and organizes data

39
New cards

Strictly Typed

It is an error to use a type with an operation not valid on that type

Explore top notes

note
Chapter 24: Lipid Metabolism
Updated 1261d ago
0.0(0)
note
A Day with My Cat
Updated 89d ago
0.0(0)
note
APUSH Unit 4
Updated 681d ago
0.0(0)
note
Minerals and Rocks
Updated 1262d ago
0.0(0)
note
4.1: Reconstruction
Updated 1253d ago
0.0(0)
note
Chapter 24: Lipid Metabolism
Updated 1261d ago
0.0(0)
note
A Day with My Cat
Updated 89d ago
0.0(0)
note
APUSH Unit 4
Updated 681d ago
0.0(0)
note
Minerals and Rocks
Updated 1262d ago
0.0(0)
note
4.1: Reconstruction
Updated 1253d ago
0.0(0)

Explore top flashcards

flashcards
Senderos 2 Chapter 1
83
Updated 187d ago
0.0(0)
flashcards
APHG Unit 3 Vocab
63
Updated 1229d ago
0.0(0)
flashcards
📙 ALL VERB SETS 📙
55
Updated 725d ago
0.0(0)
flashcards
unit 7
99
Updated 777d ago
0.0(0)
flashcards
Psychology Ch 12 and 13
58
Updated 1116d ago
0.0(0)
flashcards
Biology Lab Chemistry of Life
32
Updated 910d ago
0.0(0)
flashcards
Probook 6 2024
41
Updated 764d ago
0.0(0)
flashcards
Senderos 2 Chapter 1
83
Updated 187d ago
0.0(0)
flashcards
APHG Unit 3 Vocab
63
Updated 1229d ago
0.0(0)
flashcards
📙 ALL VERB SETS 📙
55
Updated 725d ago
0.0(0)
flashcards
unit 7
99
Updated 777d ago
0.0(0)
flashcards
Psychology Ch 12 and 13
58
Updated 1116d ago
0.0(0)
flashcards
Biology Lab Chemistry of Life
32
Updated 910d ago
0.0(0)
flashcards
Probook 6 2024
41
Updated 764d ago
0.0(0)