Midterms

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/50

flashcard set

Earn XP

Description and Tags

Data types, Variable, operators, and expression

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

51 Terms

1
New cards

Primitive Data Types

  • built into the java language.

  • these are data that are not objects and have no methods.

2
New cards

Integer Types

  • Includes Byte, Short, int, and long.

  • are signed, positive, and negative values since java does not support unsigned values.

3
New cards

High-order bit

  • defines the sign of an integer value, and java manages it differently by adding a special “unsigned right shift“ operation

4
New cards

Byte

  • smallest integer type that represent a small number

  • -128 and 127

5
New cards

Short

  • -32768 and 32787

6
New cards

Int

  • default option usually for java because when you use int or short it gets promoted to ___

  • -2,147,483,648 to 2,147,484

7
New cards

Long

  • hold a higher number compared to a regular integer.

  • A capital letter “L“ is placed right after the value

  • ex. 20987L;

8
New cards

Floating Point Types

  • are also called “real numbers“

  • used when evaluating an expression that need fractional accuracy such as the computation of square root or a transcendental.

9
New cards

Flaot

  • single precision floating point. 

  • takes half the space of a double precision so it may be faster on some processors. 

  • f is placed to the right of the value

10
New cards

Double

  • Double processors 

  • can be faster than single precision on a modern processors that have been optimized for high-speed mathematical calculation. 

11
New cards

Character Types

  • can be divided into two a.) bye for a character (ASCII) and b.) a type in itself (Unicode)

12
New cards

ASCII

  • American Standard Code for Information Interchange

  • a code that assigns numbers to letters, digits, etc

13
New cards

Unicode character

  • made to support characters that are not traditionally used in (US) English and do not work with compilers.

14
New cards

Char data type

  • was created to support the unicode characters

15
New cards

Boolean 

  • used for logical values and can hold true or false value.

16
New cards

Abstract Data types

  • based on primitive data types but with more functionality.

  • ex. string

17
New cards

Constant

  • value cannot be changed 

  • final keyword

18
New cards

Variable

  • values can be changed in a program 

  • defined by the combination of an identifier, a type, and a optional initialization depending on the task to be performed 

19
New cards

Variable Naming Convention 

  • variable names are nouns must begin with a lowercase letter

  • If a variable name contains two letter the first word must start with a lowercase and the following words must start with an Uppercase

  • variable names must start with a letter, dollar sign, or an underscore.

  • keywords cannot be used as variable name

20
New cards

Literals 

  • values that may be assigned to primitive- or string-type variables and constant.

21
New cards

Boolean literals

  • are true and false cannot use numbers

22
New cards

Integer literals

  • numeric data that can be represented as octal, hexadecimal, and binary literals

23
New cards

Octal

  • starts with a zero prefixed

  • ex. int sex = 6;

24
New cards

Hexadecimal

  • number prefixed with 0x

  • ex. int x = 0xffff;

25
New cards

Binary literal

  • number starts with 0B or 0b

26
New cards

Floating-point literals

  • numbers that have a decimal fraction.

  • suffix letter F or f is added to the number otherwise will be flagged as loss of precision.

27
New cards

Character literals 

  • must be enclosed in single quotes ‘‘

28
New cards

String literals

  • enclosed in ““

29
New cards

Operators

  • used to compute and compare values and test multiple conditions.

30
New cards

Arithmetic Operators

  • mathematical operators 

  • Operand = value to be computed

  • Addition, subtraction, Multiplication, Division, and modulus.

31
New cards

Assignment Operators

  • assigns the specific value, variable, and/or functions to another variable.

  • Assignment, add, subtract, multiple, division assignment

32
New cards

Unary Operators

  • only requires one operand

  • Increment +1

  • Decrement -1

  • Logical Complement - inverts the value of boolen

33
New cards

Prefix or Pre-increment 

  • ex. x = 7, then the value will be 8 because ++x = 8

34
New cards

suffix or post-increment

  • ex. x = 12, then the value of x- - will be 11.

35
New cards

Comparison

  • All mathematical operation involving comparison between two values  

36
New cards

Shift Operators 

  • work on bits of data

  • involves moving the bit pattern to the left or right.

37
New cards

Bitwise Operators

  • perform operations bit-by-bit.

38
New cards

AND

  • results in a 1 if both bits are 1, but if any other combinations results in a 0

39
New cards

OR

  • results in a 0 when both the bits are 0. Any other combination results in 1.

40
New cards

XOR

  • Results to 0 if bits are same values, if not results in 1.

41
New cards

Logical Operators

  • used to combine the results of boolean expressions.

  • share similarities to bitwise but is limited to boolean expressions.

42
New cards

Logical AND

  • if both operands are non-zero, expression returns true, otherwise it returns false.

43
New cards

Logical OR

  • If one or both the operands are non-zero, the expression returns true; otherwise, it returns FALSE.

44
New cards

Conditional Operators

  • used to control the flow of the program. 

  • mainly used in loop statement

45
New cards

Order of Precedence of Operators

knowt flashcard image
46
New cards

Expression

  • combination of variables, constant, literals, and operators to produce a single value.

47
New cards

Arithmetic Expression

  • expression that returns a numeric value based on the operators and operands used

48
New cards

Assignment Expression

  • expression that involves assigning a value to a variable.

49
New cards

Relational Expression

  • expression that compares values using relational operators

50
New cards

Logical Expression

  • expression involving logical operators.

51
New cards

Conditional Expression

  • expression involving the use of the ternary operator (?:) to assign a value based on a condition.