COMPSCI 1101 ( SIR JAN) ( 2ND TERM)

studied byStudied by 36 people
5.0(2)
Get a hint
Hint

5 types of Operators

1 / 90

flashcard set

Earn XP

91 Terms

1

5 types of Operators

• Assignment • Arithmetic • Relational • Logical • Special

New cards
2

is an syntactically correct combinations of operands and operators.

Expression

New cards
3

They both have a TYPE and VALUE

Operators and Expressions

New cards
4

Two basic types of arithmetic operators:

Unary and Binary

New cards
5

An operator that only requires one operand

Unary Operator

New cards
6

An operator that requires two operands

Binary Operator

New cards
7

There are only _____ arithmetic operator, and ______ arithmetic operators.

1 unary, 5 binary

New cards
8

Rules which determine precisely how expressions are evaluated

Rules of Precedence and Associativity

New cards
9

Terms which are always evaluated first

Expressions within the Parenthesis ( )

New cards
10

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

Integer Arithmetic

New cards
11

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

Integer Arithmetic

New cards
12

Characterized by : variable = expression

Assignment Operator

New cards
13

Basic operator in C

Equal sign (=)

New cards
14

Can be used more than once in an expression

Assignment Operator

New cards
15

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

Condition

New cards
16

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

Integers

New cards
17

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

Condition

New cards
18

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

Relational Operator

New cards
19
Operators such as:
!=
==
<
>
<=
>=

Relational Operator

New cards
20

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

Equality Operators

New cards
21

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

Logical Operators

New cards
22

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

True

New cards
23

represents a zero value (integer or float value)

False

New cards
24

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

Double Plus Symbol (++)

New cards
25

value is first incremented and then used inside the expression

Pre-Increment Operator

New cards
26

value is first used in an expression and then incremented

Post-Increment Operator

New cards
27

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

Unary Operator

New cards
28

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

Double Minus Symbol (--)

New cards
29

value is first decremented and then used inside the expression

Pre-Decrement Operator

New cards
30

value if first used in an expression and then decremented

Post-Decrement Operator

New cards
31

operators used in special situations

Special Operator

New cards
32

5 types of special operator

Reference Operator Dereference Operator SizeOf Operator Ternary Operator Comma Operators

New cards
33

returns the address of the variable

Reference Operator

New cards
34

symbol used as a reference operator

&

New cards
35

returns the value of a variable pointed by the specified pointer

Dereference Operator

New cards
36

symbol used as a dereference operator

New cards
37

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

SizeOf Operator

New cards
38

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

2 bytes

New cards
39

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

4 bytes

New cards
40

size of char data type

1 byte

New cards
41

size of float data type

4 bytes

New cards
42

size of double data type

8 bytes

New cards
43

helps on creating a short way of writing conditional statements

Ternary Operator

New cards
44

syntax of ternary operator

condition ? S1 (True) : S2 (False)

New cards
45

comma can be used as a ____ or as a ____

Separator, Operator

New cards
46

has the least precedence of all C operators

Comma Operator

New cards
47

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

Comma Operator

New cards
48

way of converting one datatype to another

Type Conversion

New cards
49

automatically done by the compiler

Implicit Type Conversion

New cards
50

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

Largest

New cards
51

basic datatype upgrade sequence (least to greatest)

char -> int -> float -> double

New cards
52

specifies on which datatype to be converted

Explicit Type Conversion

New cards
53

explicit type conversion is also called as _______

Type Casting

New cards
54

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

PROGRAM STATEMENTS

New cards
55

(3) basic classifications of statements in C,

Primitives Decisions Loops

New cards
56

3 type of Primitive statements

Null Statement Simple Statement Compound Statement

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

  • a null expression is an empty expression

( ; )

Null Statement

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

Simple Statement

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

Compound Statement

New cards
60

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

Decision Statements

Single-decision branch Multi-decision branch

New cards
61

Single-decision branch - ____

  • if/else

New cards
62

Multi-decision branch

– switch/case

New cards
63

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

branches

New cards
64

2 kinds of branch statements?

Conditional branches

Unconditional branches

New cards
65

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

Conditional branches

New cards
66

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

Unconditional branches

New cards
67

The___ statement is a conditional, single-decision branch.

if

New cards
68

The if statement has the general format of ?

if(expression) statement;

New cards
69

IF STATEMENTS may be a ____ statement or ___ statement.

simple compound

New cards
70

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

IF ELSE IF STATEMENTS

New cards
71

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

New cards
72

____ is evaluated and its value is compared.

Expression

New cards
73

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

integer or character

New cards
74

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

New cards
75

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

ITERATIVE STATEMENTS

New cards
76

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

New cards
77

C contains three looping constructs:

The while statement

The for statements

The do/while statements

New cards
78

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

New cards
79

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

New cards
80

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

with a syntax of

While (expression){ //statement }

while loop

New cards
81

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

relational or arithmetic

New cards
82

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

while loop

New cards
83

The ____ is generally used for counted loops.

for statement

New cards
84

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

do-while loop

New cards
85

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

break AND continue

New cards
86

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

New cards
87

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

goto statement

New cards
88

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

label

New cards
89

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

goto statement

New cards
90

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

unconditional branch

New cards
91

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

conditional branches

New cards

Explore top notes

note Note
studied byStudied by 15 people
... ago
4.0(1)
note Note
studied byStudied by 23 people
... ago
5.0(2)
note Note
studied byStudied by 13 people
... ago
5.0(1)
note Note
studied byStudied by 161 people
... ago
5.0(3)
note Note
studied byStudied by 23 people
... ago
5.0(1)
note Note
studied byStudied by 8 people
... ago
5.0(1)
note Note
studied byStudied by 23 people
... ago
4.5(2)
note Note
studied byStudied by 421 people
... ago
5.0(3)

Explore top flashcards

flashcards Flashcard (57)
studied byStudied by 55 people
... ago
4.0(5)
flashcards Flashcard (58)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (21)
studied byStudied by 18 people
... ago
5.0(1)
flashcards Flashcard (43)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (25)
studied byStudied by 15 people
... ago
5.0(1)
flashcards Flashcard (133)
studied byStudied by 19 people
... ago
4.5(2)
flashcards Flashcard (25)
studied byStudied by 51 people
... ago
5.0(2)
flashcards Flashcard (60)
studied byStudied by 28 people
... ago
5.0(2)
robot