COMPSCI 1101 ( SIR JAN) ( 2ND TERM)

studied byStudied by 33 people
5.0(2)
get a hint
hint

5 types of Operators

1 / 90

Studying Progress

0%
New cards
91
Still learning
0
Almost done
0
Mastered
0
91 Terms
1
New cards

5 types of Operators

• Assignment • Arithmetic • Relational • Logical • Special

New cards
2
New cards

is an syntactically correct combinations of operands and operators.

Expression

New cards
3
New cards

They both have a TYPE and VALUE

Operators and Expressions

New cards
4
New cards

Two basic types of arithmetic operators:

Unary and Binary

New cards
5
New cards

An operator that only requires one operand

Unary Operator

New cards
6
New cards

An operator that requires two operands

Binary Operator

New cards
7
New cards

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

1 unary, 5 binary

New cards
8
New cards

Rules which determine precisely how expressions are evaluated

Rules of Precedence and Associativity

New cards
9
New cards

Terms which are always evaluated first

Expressions within the Parenthesis ( )

New cards
10
New cards

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

Integer Arithmetic

New cards
11
New cards

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

Integer Arithmetic

New cards
12
New cards

Characterized by : variable = expression

Assignment Operator

New cards
13
New cards

Basic operator in C

Equal sign (=)

New cards
14
New cards

Can be used more than once in an expression

Assignment Operator

New cards
15
New cards

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

Condition

New cards
16
New cards

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

Integers

New cards
17
New cards

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

Condition

New cards
18
New cards

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

Relational Operator

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

Relational Operator

New cards
20
New cards

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

Equality Operators

New cards
21
New cards

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

Logical Operators

New cards
22
New cards

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

True

New cards
23
New cards

represents a zero value (integer or float value)

False

New cards
24
New cards

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

Double Plus Symbol (++)

New cards
25
New cards

value is first incremented and then used inside the expression

Pre-Increment Operator

New cards
26
New cards

value is first used in an expression and then incremented

Post-Increment Operator

New cards
27
New cards

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

Unary Operator

New cards
28
New cards

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

Double Minus Symbol (--)

New cards
29
New cards

value is first decremented and then used inside the expression

Pre-Decrement Operator

New cards
30
New cards

value if first used in an expression and then decremented

Post-Decrement Operator

New cards
31
New cards

operators used in special situations

Special Operator

New cards
32
New cards

5 types of special operator

Reference Operator Dereference Operator SizeOf Operator Ternary Operator Comma Operators

New cards
33
New cards

returns the address of the variable

Reference Operator

New cards
34
New cards

symbol used as a reference operator

&

New cards
35
New cards

returns the value of a variable pointed by the specified pointer

Dereference Operator

New cards
36
New cards

symbol used as a dereference operator

New cards
37
New cards

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

SizeOf Operator

New cards
38
New cards

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

2 bytes

New cards
39
New cards

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

4 bytes

New cards
40
New cards

size of char data type

1 byte

New cards
41
New cards

size of float data type

4 bytes

New cards
42
New cards

size of double data type

8 bytes

New cards
43
New cards

helps on creating a short way of writing conditional statements

Ternary Operator

New cards
44
New cards

syntax of ternary operator

condition ? S1 (True) : S2 (False)

New cards
45
New cards

comma can be used as a ____ or as a ____

Separator, Operator

New cards
46
New cards

has the least precedence of all C operators

Comma Operator

New cards
47
New cards

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

Comma Operator

New cards
48
New cards

way of converting one datatype to another

Type Conversion

New cards
49
New cards

automatically done by the compiler

Implicit Type Conversion

New cards
50
New cards

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

Largest

New cards
51
New cards

basic datatype upgrade sequence (least to greatest)

char -> int -> float -> double

New cards
52
New cards

specifies on which datatype to be converted

Explicit Type Conversion

New cards
53
New cards

explicit type conversion is also called as _______

Type Casting

New cards
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

New cards
55
New cards

(3) basic classifications of statements in C,

Primitives Decisions Loops

New cards
56
New cards

3 type of Primitive statements

Null Statement Simple Statement Compound Statement

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

  • a null expression is an empty expression

( ; )

Null Statement

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

Simple Statement

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

Compound Statement

New cards
60
New cards

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

Decision Statements

Single-decision branch Multi-decision branch

New cards
61
New cards

Single-decision branch - ____

  • if/else

New cards
62
New cards

Multi-decision branch

– switch/case

New cards
63
New cards

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

branches

New cards
64
New cards

2 kinds of branch statements?

Conditional branches

Unconditional branches

New cards
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

New cards
66
New cards

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

Unconditional branches

New cards
67
New cards

The___ statement is a conditional, single-decision branch.

if

New cards
68
New cards

The if statement has the general format of ?

if(expression) statement;

New cards
69
New cards

IF STATEMENTS may be a ____ statement or ___ statement.

simple compound

New cards
70
New cards

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

IF ELSE IF STATEMENTS

New cards
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

New cards
72
New cards

____ is evaluated and its value is compared.

Expression

New cards
73
New cards

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

integer or character

New cards
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

New cards
75
New cards

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

ITERATIVE STATEMENTS

New cards
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

New cards
77
New cards

C contains three looping constructs:

The while statement

The for statements

The do/while statements

New cards
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

New cards
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

New cards
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

New cards
81
New cards

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

relational or arithmetic

New cards
82
New cards

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

while loop

New cards
83
New cards

The ____ is generally used for counted loops.

for statement

New cards
84
New cards

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

do-while loop

New cards
85
New cards

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

break AND continue

New cards
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

New cards
87
New cards

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

goto statement

New cards
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

New cards
89
New cards

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

goto statement

New cards
90
New cards

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

unconditional branch

New cards
91
New cards

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 664 people
Updated ... ago
5.0 Stars(9)
note Note
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 70 people
Updated ... ago
5.0 Stars(3)
note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)

Explore top flashcards

flashcards Flashcard38 terms
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard56 terms
studied byStudied by 41 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard30 terms
studied byStudied by 47 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard35 terms
studied byStudied by 20 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard39 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard95 terms
studied byStudied by 36 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard38 terms
studied byStudied by 945 people
Updated ... ago
4.3 Stars(15)
flashcards Flashcard56 terms
studied byStudied by 13 people
Updated ... ago
5.0 Stars(1)