Constants and Operators Flashcards

1
Q

refer to fixed values that the program may not alter during its
execution

A

Constants

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

fixed values

A

Literals

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

Constants may belong to

A

any of the data type

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

basic data types

A

integer constant
floating-point constant
character constant or a string literal
enumeration constant (enum)

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

Two data types that must have at least one digit

A

Integer and Floating Point Constants

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

A data type that must not have a decimal point

A

Integer Constants

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

Two data types that can either be positive or negative

A

Integer and Floating Point Constants

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

No commas or blanks are allowed within __

A

Integer Constant and Real Constant

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

If no sign precedes an integer constant, then

A

it is assumed to be positive.

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

An integer constant is assumed to be positive if

A

no sign precedes an integer constant

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

The allowable range for integer constants is

A

-32768 to 32767

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

A data type that must have a decimal point

A

Floating Point Constants

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

You can represent floating point literals either

A

decimal form or
exponential form

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

A floating-point literal has

A

integer part
decimal point
fractional part
exponent part

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

A single alphabet, a single digit or a single special symbol enclosed within single quotes

A

Character Constants

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

The maximum length of a character constant is

A

1 character

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

Enclosed within double quotes

A

String Constants

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

Contains characters that are similar to character literals:

A

plain character
escape sequences

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

Two ways of defining constants

A

Using #define preprocessor
Using const keyword

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

Syntax of #define preprocessor

A

define IDENTIFIER value

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

Syntax of const keyword

A

const type variable = value;

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

Something that acts on a variable or an expression

A

Operators

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

Operators does

A

computes or retrieves a value
changes an object

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

The symbols which are used to perform logical and mathematical
operations in a C program

A

Operators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Join individual constants and variables to form expressions
Operators
26
Operators are used to perform _ and _ operations in a C program
logical and mathematical
27
Expressions can be _
nested
28
Types of Operators
Arithmetic operators Assignment operators Increment/decrement operators Relational operators Logical operators Conditional operators (ternary operators) Special operators
29
Operators that perform +, -, *, /
Arithmetic Operators
30
require one operand
Unary
31
require two operands
Binary
32
% requires _ operands
integer
33
The / can produce surprising results. When both of the operands are int, the result
truncated
34
Operator Precedence
``` Highest + - (unary) * / % Lowest + - (binary) ```
35
Left Associative
`* / % + -`
36
Right Associative
unary operators ( + - )
37
The = operator is _ associative
right associative
38
Can have a value assigned to them
Lvalues
39
Placed on the left side of an equal sign
Lvalues
40
Compound Assignment Operators Associativity
right associative
41
Increment and Decrement Operators
++ (increment) -- (decrement)
42
used to increase the value of the variable by one
Increment operators (i++, ++i)
43
used to decrease the value of the variable by on
Decrement operators(i--, --i)
43
used to decrease the value of the variable by on
Decrement operators(i--, --i)
44
Value of expression is an incremented/decremented value
++i;
45
Value of expression is the original value, before it was modified
i++
46
All binary operators → taking 2 operands
Relational Operators
47
If the relation is true, it returns
1
48
If the relation is false, it returns
0
49
Used to compare values, usually in making decisions
Relational Operators
50
Relational Operators Precedence
Arithmetic operators have higher priority than relational operators
51
Relational Operators Associativity
The relational operators are left associative
52
Equality Operators (equal to)
==
53
Equality Operators (not equal to)
!=
54
Equality Operators Associativity
Left associative
55
Equality Operators produce
True (1) or False (0)
56
Equality Operators Precedence
lower precedence than relational operators
57
Logical operators
&& || !
58
used when more than one conditions are to be tested and based on that result, decisions have to be made
Logical Operators
59
Logical AND
&&
60
Logical OR
||
61
Logical NOT
!
62
Logical NOT
!
63
Logical NOT
!
64
Logical NOT
!