Comp Sci Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

How many bits in a byte

A

8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How many bits in a nibble

A

4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Files

A

a large group of bytes in auxiliary memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the place called where files are stored

A

directories/folders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which takes precedence in the ||: True or False

A

True takes precedence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which takes precedence in the &&: True or False

A

False takes precedence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does an enumeration do

A

lists the values a variable can have

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

int m = 4;
int results = 3 * (++m);

A

results = 15

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

int m = 4;
int results = 3 * (m++);

A

results = 12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is encoding

A

translating from one set of symbols to another set of symbols (integer to binary)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the 8 primitive data types

A

int, double, char, Boolean, float, long, short, byte

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are 6 comparison operators

A

==, <=, >=, !=, <, >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the 3 logical operators

A

&&, ||, !

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Lexicographic Order rules

A

all numbers come before letters and all uppercase letters come before lowercase letters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the Lexicographic Order based on

A

based on the character order in the Unicode character set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is another word for conditional operator

A

ternary operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

When is a boolean expression a tautology

A

when the result is always true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

When is a boolean expression a contradiction

A

when the result is always false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

When is a boolean expression a contingency

A

when it is neither a tautology nor a contradiction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Tautology/Contradiction/Contingency?

(x == y) || (x != y)

A

tautology

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Tautology/Contradiction/Contingency?

(x == y) && (x != y)

A

contradiction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Tautology/Contradiction/Contingency?

(x && y)
where both x and y = boolean values

A

contingency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

general formula for encoding

A

ceiling(log2(n))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

general formula for encoding in English

A

see how many times we can divide by 2 (starting at n) until we reach the quotient 0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are the 4 types of integer values

A

byte, int, short, long

26
Q

What the 2 types of floating point numbers

A

float, double

27
Q

What kind of value is a character

A

single character

28
Q

What kind of value is a boolean

A

Boolean

29
Q

how much memory does one byte use

A

1 byte

30
Q

how much memory does one int or one float use

A

4 bytes

31
Q

how much memory does one short or one char use

A

2 bytes

32
Q

how much memory does one long or one double use

A

8 bytes

33
Q

What does ASCII stand for

A

American Standard Code for Information Interchange

34
Q

How many symbols does 7-bit ASCII contain

A

2^7 (128 symbols)

35
Q

How many symbols does 8-bit ASCII contain

A

2^8 (256 symbols)

36
Q

Java uses _________ for ____

A

16-bit Unicode, char

37
Q

what are 2 ways floating-point constant can be written as

A

1, numbers after decimal place
2. e notation

38
Q

In Java, you can’t store a floating-point number in a variable that is declared as an int because…

A

Java is said to be strongly typed

39
Q

What is the data stored by a variable called

A

value

40
Q

Which one is the assignment operator: = or ==?

A

=

41
Q

RAM

A

random access memory

42
Q

main memory is a type of ___________

A

volatile memory

43
Q

auxiliary memory is also called…

A

secondary memory

44
Q

what is a program

A

a finite sequence of instructions for a computer to follow written in a programming language

45
Q

Following the instructions is called

A

running or
executing the program

46
Q

What is a process

A

a program that is currently executing

47
Q

What does the operating system do?

A

oversees the operation of the computer and its main job is to manage processes and hardware resources

48
Q

do computers understand high-level languages like java?

A

no which is why computers have compilers

49
Q

what do compilers do

A

they translate programs from high-level languages to low-level languages

50
Q

Does the java compiler translate from java to machine language?

A

no, it translates it into java byte-code

51
Q

What happens after the Java compiler translates the program to byte-code

A

the interpreter translates each byte-code instruction into machine language before it moves on to the next byte-code instruction

52
Q

The class loader…

A

automatically connects different classes together in Java

53
Q

What is a package

A

a library of classes that have already been defined
ex. java.util.Math;

54
Q

what does a statement end with

A

a semicolon;

55
Q

what are the grammar rules of code called

A

syntax

56
Q

When printing to a screen (System.out.println()) which part is the object and which part is the method/function?

A

Object- System.out
Method/Function- println

57
Q

What is the difference between the pre-compiled version and the byte-code version of a program

A

they have the same name, but the pre-compiled version ends in .java, while the byte-code version ends in .class

58
Q

What are the 3 types of errors

A
  1. Syntax error
  2. Run-time error
  3. Logic/Semantic errors
59
Q

What are syntax errors?

A

grammatical errors; they are shown with red squiggly line under code or smthg like that

60
Q

What are runtime errors?

A

Errors that occur when you run a program (like dividing by zero or going Index Out of Bounds); the program usually terminates itself in times like this

61
Q

What are logic/ semantic errors?

A

Errors that allow the program to run, but produce incorrect results like if you wanted a program that produces the sum of numbers but you accidentally put the formula as x - y. The program will still run, but it will give you the wrong value as the sum.

62
Q

you got this

A

i bet i do