Lesson 2 Flashcards
(32 cards)
What is computer programming?
- Computer programming, often called coding, is the process of writing, testing, debugging, and maintaining the source code of computer programs.
What is a computer program?
- A computer program, also known as a software program, is a structured collection of instructions for the computer.
Who is a computer programmer?
- A computer programmer is a professional or individual who writes programs.
Who developed the C programming language and when?
- C was developed in 1972 by Dennis Ritchie at Bell Telephone Laboratories.
What was the original purpose of the C language?
- C was designed to implement the UNIX operating system and write system software that is architecturally independent.
Which programming languages were influenced by C?
- C greatly influenced C++, which began as an extension of C, as well as Java, which borrows C’s lexical conventions and operators.
Why is C considered versatile across different platforms?
- C is widely used on many software platforms, and there are few computer architectures that do not have a C compiler.
What are the main data types in C?
- The main data types are:
-
char
: used to hold characters. -
float
: used to hold real numbers (32-bit). -
double
: used to hold real numbers (64-bit). -
void
: represents no value. -
int
: used for whole numbers.
-
What are keywords in C?
- Keywords are reserved words that have special meaning in the C language, such as
auto
,break
,double
,int
, andcase
.
What are identifiers in C?
- Identifiers are composed of a sequence of letters, digits, and underscores (_), typically between 8 and 15 characters long.
What are variables in C?
- Variables are identifiers that store changeable values.
What are the rules for defining variables in C?
- A variable must consist of letters, digits, and underscores.
- It should not begin with a digit.
- It cannot redefine an identifier from the C standard library.
- It is case-sensitive (uppercase and lowercase are different).
- Embedded blanks are not allowed.
- C language keywords cannot be used as variable names.
What must be done before using variables in a C program?
- All variables must be declared before they are used.
What are local variables in C?
- Local variables are declared inside a function and are only accessible within that function.Example:
c #include <stdio.h> int main() { int a, b, c; // local variables }
What are global variables in C?
- Global variables are declared outside any function and are accessible to all functions within the program.Example:
c #include <stdio.h> int a, b, c; // global variables int main() { }
What are constants in C?
- Constants are identifiers or variables that store values that cannot be changed during program execution.
What is an operator in C?
- An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
What are examples of arithmetic operators in C?
- Arithmetic operators include
+
,-
,*
,/
,++
, and--
.
What are examples of relational operators in C?
- Relational operators include
>
,<
,<=
,>=
,==
, and!=
.
What are examples of logical operators in C?
- Logical operators include
&&
(AND) and||
(OR).
What are examples of logical operators in C?
- Logical operators include
&&
(AND) and||
(OR).
What is the purpose of the \n
symbol in C?
- The
\n
symbol is a newline character used to move the cursor to the next line.
When do we use single quotes ' '
in C?
- Single quotes are used to represent a single character or letter.
What are double quotes "
used for in C?
- Double quotes are used to represent two or more characters, typically for strings.