Midterm Review Flashcards Preview

Comp Sci > Midterm Review > Flashcards

Flashcards in Midterm Review Deck (27)
Loading flashcards...
1
Q

What does // represent?

A

A comment that can continue to the end of the line

2
Q

What does /* asdfghjkl; */ represent?

A

A comment that can last multiple lines between the slashes

3
Q

What does /** asdfghjkl; */ represent?

A

A javadoc comment

4
Q

What is a syntax error?

A

A problem in the code makes a program unable to run

5
Q

What is a logical error?

A

A program runs, but does not function properly due to a logic error

6
Q

What is a run time error?

A

Something input to the code causes it to crash

7
Q

What happens when a java program is run?

A

It is converted to byte code then to machine language

8
Q

What happens when you type in a URL?

A

DNS converts it to an IP address

9
Q

What can be used in an identifyer?

A

Letters, underscores, digits, $

10
Q

What should class names always be in?

A

Title case

11
Q

What’s the difference between high level and machine level code?

A

Machine is more abstract, and high level uses human language

12
Q

What is analog like?

A

Continuous and exact

13
Q

What is digital like?

A

Finite and not exact, but cheaper

14
Q

What test simulates a human conversation?

A

Turring test

15
Q

Where does java.charAt find letters?

A

Each letter is numbered, 0 is the first letter

16
Q

What is assignment conversion?

A

Taking an int value and reassigning it as a double

17
Q

What is casting?

A

Specifying the output for something

18
Q

What is arithmetic promotion?

A

Doing math with 2 ints and storing it as a double

19
Q

What does an enumerated datatype do?

A

Store data from a small fixed set

20
Q

What class allows a primitive data to be used as an object?

A

Wrapper class

21
Q

How would you generate a random integer between 3 and 30 in Java?

A

math.nextInt(28) + 3

22
Q

What would num++ be?

A

num=num+1

23
Q

What would num+=10 be?

A

num=num+10

24
Q

What happens when you divide 2 interger values and store it in a double?

A

They will return an interger with no decimal, stored in a double. If you want said decimal, cast

25
Q

How do you find the last character of a string?

A

x.charAt(x.length()-1);

26
Q

How do you prep for the square root of a negative number in java?

A

Math.sqrt(Math.abs(x));

27
Q

What does % do?

A

Return the remainder of division as an int