COMPSCI 1101 ( SIR JAN) ( 2ND TERM)

5.0(4)
studied byStudied by 38 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/90

flashcard set

Earn XP

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

91 Terms

1
New cards

5 types of Operators

• Assignment
• Arithmetic
• Relational
• Logical
• Special

2
New cards

is an syntactically correct
combinations of operands and operators.

Expression

3
New cards

They both have a TYPE and VALUE

Operators and Expressions

4
New cards

Two basic types of arithmetic operators:

Unary and Binary

5
New cards

An operator that only requires one operand

Unary Operator

6
New cards

An operator that requires two operands

Binary Operator

7
New cards

There are only arithmetic operator, and _ arithmetic operators.

1 unary, 5 binary

8
New cards

Rules which determine precisely how expressions are evaluated

Rules of Precedence and Associativity

9
New cards

Terms which are always evaluated first

Expressions within the Parenthesis ( )

10
New cards

In , all decimal portions of
numbers are lost (or truncated).

Integer Arithmetic

11
New cards

Evaluates an arithmetic expression consisting of an operator and two integer operands.

Integer Arithmetic

12
New cards

Characterized by : variable = expression

Assignment Operator

13
New cards

Basic operator in C

Equal sign (=)

14
New cards

Can be used more than once in an expression

Assignment Operator

15
New cards

An assumption on which tests the validity or effect
of something else

Condition

16
New cards

Are used to represent true or false because
there is no actual boolean or logical data type in C

Integers

17
New cards

An expression that is either true (represented by 1)
or false (represented by 0)

Condition

18
New cards

Are used to test specific conditions and requires the use of two operands

Relational Operator

19
New cards

Operators such as:

!=

< >
<=

=

Relational Operator

20
New cards

Relational Operators == and != are often referred to as-

Equality Operators

21
New cards

Connects two or more relational
expressions into one or reverse the logic of an
expression.

Logical Operators

22
New cards

represents a non-zero value (can be negative
or positive numbers, float, character, string)

True

23
New cards

represents a zero value (integer or float
value)

False

24
New cards

symbol used as an increment operator to increment or add 1 to the operand value

Double Plus Symbol (++)

25
New cards

value is first incremented and then used inside the expression

Pre-Increment Operator

26
New cards

value is first used in an expression and then incremented

Post-Increment Operator

27
New cards

increment and decrement operators are considered as _ since they require only one operand

Unary Operator

28
New cards

symbol used as an decrement operator to decrement or subtract 1 to the operand value

Double Minus Symbol (--)

29
New cards

value is first decremented and then used inside the expression

Pre-Decrement Operator

30
New cards

value if first used in an expression and then decremented

Post-Decrement Operator

31
New cards

operators used in special situations

Special Operator

32
New cards

5 types of special operator

Reference Operator
Dereference Operator
SizeOf Operator
Ternary Operator
Comma Operators

33
New cards

returns the address of the variable

Reference Operator

34
New cards

symbol used as a reference operator

&

35
New cards

returns the value of a variable
pointed by the specified pointer

Dereference Operator

36
New cards

symbol used as a dereference operator

*

37
New cards

used to determine or compute the operand's size in bytes

SizeOf Operator

38
New cards

the size of int data type in the TurboC application, as it is a 16-bit-based application

2 bytes

39
New cards

the size of int data type in today's compilers (e.g., MinGW GCC Compiler)

4 bytes

40
New cards

size of char data type

1 byte

41
New cards

size of float data type

4 bytes

42
New cards

size of double data type

8 bytes

43
New cards

helps on creating a short way of writing conditional statements

Ternary Operator

44
New cards

syntax of ternary operator

condition ? S1 (True) : S2 (False)

45
New cards

comma can be used as a ____ or as a ____

Separator, Operator

46
New cards

has the least precedence of all C operators

Comma Operator

47
New cards

returns the rightmost value of an expression but first evaluate the rest of the expressions and discard their values

Comma Operator

48
New cards

way of converting one datatype to another

Type Conversion

49
New cards

automatically done by the compiler

Implicit Type Conversion

50
New cards

in the implicit type conversion, datatypes in the expression will be converted into the datatype used within the expression

Largest

51
New cards

basic datatype upgrade sequence (least to greatest)

char -> int -> float -> double

52
New cards

specifies on which datatype to be converted

Explicit Type Conversion

53
New cards

explicit type conversion is also called as _

Type Casting

54
New cards

There are three (3) basic classifications of
statements in C, and actually, there are very few
statements of each type.

PROGRAM STATEMENTS

55
New cards

(3) basic classifications of
statements in C,

Primitives
Decisions
Loops

56
New cards

3 type of Primitive statements

Null Statement
Simple Statement
Compound Statement

57
New cards
  • is made up of a null expression followed by a semicolon.
  • a null expression is an empty expression

( ; )

Null Statement

58
New cards
  • Expression and function call statements
    expression;
    function_call();

Simple Statement

59
New cards
  • or also called as block is formed by placing more than one statement inside curly braces ({}).
    {
    statement;
    statement;
    }

Compound Statement

60
New cards

Conditional branches - make decision before branching:
and its 2 type

Decision Statements

Single-decision branch
Multi-decision branch

61
New cards

Single-decision branch - ____

  • if/else
62
New cards

Multi-decision branch

– switch/case

63
New cards

Decision statements are actually part of a larger category statements known as ??

branches

64
New cards

2 kinds of branch statements?

Conditional branches

Unconditional branches

65
New cards

involves making one or more decisions before branching, and are thus referred to as single-decision or multi-decision branches.

Conditional branches

66
New cards

direct branches which involve no decision. The goto statement is an example of an unconditional branch.

Unconditional branches

67
New cards

The___ statement is a conditional, single-decision branch.

if

68
New cards

The if statement has the general format of ?

if(expression) statement;

69
New cards

IF STATEMENTS may be a ____ statement or ___ statement.

simple
compound

70
New cards

it allows you to check between multiple test expressions and execute different statements.

IF ELSE IF STATEMENTS

71
New cards

a conditional, multi-decision branch. The previous example of successive comparison of equality or value of the operand is so common in programming, a special construct exist in C to handle such comparison.

SWITCH-CASE STATEMENTS

72
New cards

____ is evaluated and its value is compared.

Expression

73
New cards

The expression and the constant compared against must be an _ constants or expressions. They may NOT contain variables.

integer or character

74
New cards

The default case is optional, but if it exists there can be ____. It may occur anywhere in the list of case clauses but usually occur at the end

only one

75
New cards

One of the fundamental properties of a computer is its ability to repetitively execute a set of statements.

ITERATIVE STATEMENTS

76
New cards

These looping capabilities enable the programmer to develop concise programs containing repetitive processes that could otherwise require thousands of program statements to perform.

ITERATIVE STATEMENTS

77
New cards

C contains three looping constructs:

The while statement

The for statements

The do/while statements

78
New cards

The _ statements may be described as
test-before-execute. If the controlling condition
results initially to a zero or false value, the body
of the loop is never executed.

while and for

79
New cards

The ____statement on the other hand may be
considered as execute-before-test. The body of the
loop is always executed at least once.

do-while

80
New cards

The _is used to execute a statement as
long as a condition remains true.

with a syntax of

While (expression){
//statement
}

while loop

81
New cards

The conditional expression, of course, may be
a _ or ____.

relational or arithmetic

82
New cards

_ is usually used when the number of times the loop must be executed is not known in advance.

while loop

83
New cards

The ____ is generally used for counted
loops.

for statement

84
New cards

The will execute a statement and then evaluate a conditional expression.

do-while loop

85
New cards

The statements____ and ___ are used to
interrupt the normal flow of loops and the switch
statement.

break AND continue

86
New cards

The ____ is similar to the break statement, except it does not cause the loop to terminate. Rather it causes the loop to be continued.

continue statement

87
New cards

The ____ causes the flow of the program
to branch to the statement immediately following
the appropriate label.

goto statement

88
New cards

A _is a name that is formed with the same rules in identifiers and must be immediately followed by a colon.

label

89
New cards

The _ interrupts the normal sequential flow of a program, without involving a decision.

goto statement

90
New cards

Since goto statement is an example of _ it is difficult to use without the help of conditional branch statements.

unconditional branch

91
New cards

We can properly use goto statements by using some of the _to avoid infinite looping execution.

conditional branches