Lesson 2 Flashcards

(32 cards)

1
Q

What is computer programming?

A
  • Computer programming, often called coding, is the process of writing, testing, debugging, and maintaining the source code of computer programs.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a computer program?

A
  • A computer program, also known as a software program, is a structured collection of instructions for the computer.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Who is a computer programmer?

A
  • A computer programmer is a professional or individual who writes programs.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Who developed the C programming language and when?

A
  • C was developed in 1972 by Dennis Ritchie at Bell Telephone Laboratories.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What was the original purpose of the C language?

A
  • C was designed to implement the UNIX operating system and write system software that is architecturally independent.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which programming languages were influenced by C?

A
  • C greatly influenced C++, which began as an extension of C, as well as Java, which borrows C’s lexical conventions and operators.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is C considered versatile across different platforms?

A
  • C is widely used on many software platforms, and there are few computer architectures that do not have a C compiler.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the main data types in C?

A
  • 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are keywords in C?

A
  • Keywords are reserved words that have special meaning in the C language, such as auto, break, double, int, and case.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are identifiers in C?

A
  • Identifiers are composed of a sequence of letters, digits, and underscores (_), typically between 8 and 15 characters long.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are variables in C?

A
  • Variables are identifiers that store changeable values.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the rules for defining variables in C?

A
  • 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What must be done before using variables in a C program?

A
  • All variables must be declared before they are used.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are local variables in C?

A
  • 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 }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are global variables in C?

A
  • 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() { }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are constants in C?

A
  • Constants are identifiers or variables that store values that cannot be changed during program execution.
17
Q

What is an operator in C?

A
  • An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
18
Q

What are examples of arithmetic operators in C?

A
  • Arithmetic operators include +, -, *, /, ++, and --.
19
Q

What are examples of relational operators in C?

A
  • Relational operators include >, <, <=, >=, ==, and !=.
20
Q

What are examples of logical operators in C?

A
  • Logical operators include && (AND) and || (OR).
21
Q

What are examples of logical operators in C?

A
  • Logical operators include && (AND) and || (OR).
22
Q

What is the purpose of the \n symbol in C?

A
  • The \n symbol is a newline character used to move the cursor to the next line.
23
Q

When do we use single quotes ' ' in C?

A
  • Single quotes are used to represent a single character or letter.
24
Q

What are double quotes " used for in C?

A
  • Double quotes are used to represent two or more characters, typically for strings.
25
**What does the open curly brace `{` signify in C?**
- The open curly brace `{` signifies the beginning of a block of code.
26
**What does the close curly brace `}` signify in C?**
- The close curly brace `}` signifies the end of a block of code.
27
**What is the purpose of the address operator `&` in C?**
- The address operator `&` is used to get the memory address of a variable.
28
**What is the `#include` directive in a C program?**
- The `#include` directive contains information needed by the program to ensure the correct operation of C standard library functions.
29
**What is the purpose of the `#define` directive?**
- The `#define` directive is used to shorten keywords or define constants in the program.
30
**What is the variable declaration section?**
- The variable declaration section is where you declare your variables before using them in the program.
31
**How does the body of a C program start?**
- The body of the program starts with the `main()` function, followed by `{` and `}` braces. All program statements are written inside these braces.
32
**Where should all statements be written in a C program?**
- All statements should be written inside the `{` and `}` braces of the `main()` function.