Podcast
Questions and Answers
Code should be ______ but not so short that it is cryptic
Code should be ______ but not so short that it is cryptic
concise
Identifiers should accurately describe the data being ______
Identifiers should accurately describe the data being ______
stored
The first letter of each word in camelNotation is capitalized, with the exception of the ______ word
The first letter of each word in camelNotation is capitalized, with the exception of the ______ word
first
Reserved words are used for the ______ own use
Reserved words are used for the ______ own use
Signup and view all the answers
C++ reserved words include ______, namespace, and template
C++ reserved words include ______, namespace, and template
Signup and view all the answers
Identifiers should avoid using ______ characters
Identifiers should avoid using ______ characters
Signup and view all the answers
The contents of this document are copyrighted by ______ and Seneca College
The contents of this document are copyrighted by ______ and Seneca College
Signup and view all the answers
This document is part of the introduction to ______
This document is part of the introduction to ______
Signup and view all the answers
Since characters and symbols have no intrinsic ______ representation, the host platform provides the collating sequence for associating each character and symbol with a unique integer value.
Since characters and symbols have no intrinsic ______ representation, the host platform provides the collating sequence for associating each character and symbol with a unique integer value.
Signup and view all the answers
______ is more popular and represents the letter A by the bit pattern 010000012, that is the hexadecimal value 0x41, that is the decimal value 65.
______ is more popular and represents the letter A by the bit pattern 010000012, that is the hexadecimal value 0x41, that is the decimal value 65.
Signup and view all the answers
______ and ______ are not compatible.
______ and ______ are not compatible.
Signup and view all the answers
Neither ______ nor ______ contain enough values to represent most of the characters and symbols in the world languages.
Neither ______ nor ______ contain enough values to represent most of the characters and symbols in the world languages.
Signup and view all the answers
A ______ programming language uses a type system to interpret the bit streams in memory.
A ______ programming language uses a type system to interpret the bit streams in memory.
Signup and view all the answers
The Unicode standard, which is compatible with ______, provides a much more comprehensive collating system.
The Unicode standard, which is compatible with ______, provides a much more comprehensive collating system.
Signup and view all the answers
There are three schemes for storing negative integers: ______ notation (most popular), 1's complement notation, and sign magnitude notation.
There are three schemes for storing negative integers: ______ notation (most popular), 1's complement notation, and sign magnitude notation.
Signup and view all the answers
A ______ is the rule that defines how to store values in memory and which operations are admissible on those values.
A ______ is the rule that defines how to store values in memory and which operations are admissible on those values.
Signup and view all the answers
A ______ occupies one byte and can store a small integer value, a single character or a single symbol.
A ______ occupies one byte and can store a small integer value, a single character or a single symbol.
Signup and view all the answers
An ______ occupies one word and can store an integer value.
An ______ occupies one word and can store an integer value.
Signup and view all the answers
The four most common types in the C language for performing arithmetic calculations are ______, int, float, and double.
The four most common types in the C language for performing arithmetic calculations are ______, int, float, and double.
Signup and view all the answers
This chapter describes the four most common ______ in the C language and the ranges of values that these types allow.
This chapter describes the four most common ______ in the C language and the ranges of values that these types allow.
Signup and view all the answers
After reading this section, you will be able to select appropriate ______ for storing program variables and constants.
After reading this section, you will be able to select appropriate ______ for storing program variables and constants.
Signup and view all the answers
This chapter concludes by describing how to allocate memory for variables by identifying their contents using a ______.
This chapter concludes by describing how to allocate memory for variables by identifying their contents using a ______.
Signup and view all the answers
To obtain the 2's complement of an integer, we ______ the bits and add one
To obtain the 2's complement of an integer, we ______ the bits and add one
Signup and view all the answers
The IEEE 754 standard is used for ______ and Floating-Point Arithmetic
The IEEE 754 standard is used for ______ and Floating-Point Arithmetic
Signup and view all the answers
A float has ______ bits, consisting of one sign bit, an 8-bit exponent and a 23-bit significand
A float has ______ bits, consisting of one sign bit, an 8-bit exponent and a 23-bit significand
Signup and view all the answers
A double occupies ______ bits, has one sign bit, an 11-bit exponent and a 52-bit significand
A double occupies ______ bits, has one sign bit, an 11-bit exponent and a 52-bit significand
Signup and view all the answers
The number of bits in the significand is limited, so the ______ and double types cannot store all possible floating-point values exactly
The number of bits in the significand is limited, so the ______ and double types cannot store all possible floating-point values exactly
Signup and view all the answers
The number of bytes allocated for a type determines the ______ of values that that type can store
The number of bytes allocated for a type determines the ______ of values that that type can store
Signup and view all the answers
Ranges for some types depend on the ______ environment:
Ranges for some types depend on the ______ environment:
Signup and view all the answers
The type ______ has a size of 8 bits:
The type ______ has a size of 8 bits:
Signup and view all the answers
The ______ type has a minimum size of 16 bits:
The ______ type has a minimum size of 16 bits:
Signup and view all the answers
The limits on a ______ and double depend on the execution environment:
The limits on a ______ and double depend on the execution environment:
Signup and view all the answers
We store program data in ______:
We store program data in ______:
Signup and view all the answers
A declaration associates a program ______ with a type:
A declaration associates a program ______ with a type:
Signup and view all the answers
The type of a variable identifies its ______ properties:
The type of a variable identifies its ______ properties:
Signup and view all the answers
The limits on the ______ are in base 10:
The limits on the ______ are in base 10:
Signup and view all the answers
Study Notes
Naming Conventions
- Use descriptive and concise names that do not require comments to describe their purpose
- Use "camelNotation" (first letter of each word capitalized except the first word)
- Avoid underscore characters to avoid conflicts with system libraries
Reserved Words
- The C language reserves specific words for its own use, including:
- auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, inline, int, long, register, return, short, signed, sizeof, static, struct, switch, typedef, union, unsigned, void, volatile, while
- Avoid using C++ reserved words, including:
- asm, bool, catch, class, const_cast, delete, dynamic_cast, explicit, export, false, friend, mutable, namespace, new, operator, private, protected, public, reinterpret_cast, static_cast, template, this, throw, typeid, typename, using, virtual, wchar_t
Introduction to C
- C is a typed programming language that uses a type system to interpret bit streams in memory
- A type defines how to store values in memory and which operations are admissible on those values
- The relation between types and raw memory is illustrated in the figure below
Types
- Four most common types in C are:
- char
- int
- float
- double
Arithmetic Types
- char:
- Occupies one byte
- Can store a small integer value, a single character, or a single symbol
- int:
- Occupies one word
- Can store an integer value
Negative Values
- Three schemes for storing negative integers:
- 2's complement notation (most popular)
- 1's complement notation
- Sign magnitude notation
- To obtain the 2's complement of an integer:
- Flip the bits
- Add one
Floating-Point Data
- Floating-point types store tiny and huge values by decomposing values into three components:
- Sign
- Exponent
- Significand (or mantissa)
- IEEE 754 Standard for Binary and Floating-Point Arithmetic is the most popular model
- float:
- 32 bits
- One sign bit, 8-bit exponent, and 23-bit significand (or mantissa)
- double:
- 64 bits
- One sign bit, 11-bit exponent, and 52-bit significand (or mantissa)
Value Ranges
- The number of bytes allocated for a type determines the range of values that that type can store
- Ranges for some types depend on the execution environment
- Integral types:
- char: -128 to 127 or 0 to 255
- short: -32,768 to 32,767
- int: -32,768 to 32,767 (2 bytes) or -2,147,483,648 to 2,147,483,647 (4 bytes)
- long: -2,147,483,648 to 2,147,483,647 (4 bytes) or -9,233,372,036,854,775,808 to 9,233,372,036,854,775,807 (8 bytes)
- Floating-point types:
- float: depends on the execution environment
- double: depends on the execution environment
Variable Declarations
- A declaration associates a program variable with a type
- The type identifies the properties of the variable
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
This quiz explores how C language associates characters and symbols with unique integer values using collating sequences such as ASCII and EBCDIC.