What is the first topic covered in the outline?
First C program & Language Syntax.
What is the second topic in the outline?
Variables and Assignment Operators.
1/206
p.1
Overview of C Language

What is the first topic covered in the outline?

First C program & Language Syntax.

p.1
Variables and Assignment Operators

What is the second topic in the outline?

Variables and Assignment Operators.

p.1
Identifiers and Reserved Words

What does the outline mention after Variables and Assignment Operators?

Identifiers, Reserved Words, Predefined Identifiers.

p.1
Data Types and Numeric Constants

What is covered in the fourth point of the outline?

Data Types, Numeric Constants, String Literals.

p.1
Console Input/Output with scanf() and printf()

What is the final topic mentioned in the outline?

Console Input/Output Using scanf() and printf().

p.23
Identifiers and Reserved Words

Can an identifier start with a digit?

No, it must not start with a digit.

p.27
Identifiers and Reserved Words

Why should names with all uppercase letters be avoided?

They are usually reserved for named constants.

p.13
Variables and Assignment Operators

What is the syntax for declaring multiple variables of the same type?

type2 var1, var2, …, varN;

p.26
Identifiers and Reserved Words

Which of the following is a valid identifier: $ abc?

No, it is not a valid identifier.

p.6
String Constants and Escaped Sequences

What is a string constant in the context of the printf() function?

A piece of text enclosed in quotes, such as "Hello, world!\n".

p.23
Identifiers and Reserved Words

What is an identifier in a program?

A name used to identify variables, functions, etc.

p.9
String Constants and Escaped Sequences

Can a string constant span multiple lines?

No, a string constant cannot span multiple lines.

p.5
Comments in C

What is the purpose of comments in C?

They are used for documentation aid and are ignored by the compiler.

p.9
String Constants and Escaped Sequences

What is the output of the string constant 'The first line . The second line.'?

The first line . The second line.

p.5
Comments in C

What are the two styles of comments in C?

Block comments (/* ... */) and line comments (//).

p.25
Identifiers and Reserved Words

What are predefined identifiers in C?

Identifiers that have already been used as names for standard usages, such as main, printf, and scanf.

p.11
Variables and Assignment Operators

What does the type of a variable determine?

What kind of values the variable can hold.

p.27
Identifiers and Reserved Words

What is a key guideline for naming conventions in programming?

Names should be meaningful.

p.3
Language Syntax and Errors

What happens if a program contains syntax errors?

It cannot be compiled into an executable program.

p.7
String Constants and Escaped Sequences

What will happen if a string constant is not enclosed in double quotes?

The C compiler will not treat the text as a string constant.

p.17
Variables and Assignment Operators

What is the syntax for assigning a value to a variable?

variable = expression;

p.7
String Constants and Escaped Sequences

What will cause a C program to fail to compile?

Using printf(Hello, world! ); without double quotes.

p.17
Variables and Assignment Operators

Give an example of an expression that can be assigned to a variable.

100, someVariable, or 200 + var1 * var2.

p.16
Data Types and Numeric Constants

What data type is used for 'side', 'perimeter', and 'area' in the program?

int (integer).

p.14
Basic Structure of a C Program

What is the purpose of the 'main' function in a C program?

It serves as the entry point for program execution.

p.26
Identifiers and Reserved Words

Is tab a valid identifier?

Yes, it is a valid identifier.

p.22
Identifiers and Reserved Words

What is a reserved word?

A word that has a special meaning in a programming language and cannot be used as a variable name.

p.23
Identifiers and Reserved Words

What characters can an identifier contain?

Alphabets (A-Z, a-z), digits (0-9), and the underscore character (_).

p.17
Variables and Assignment Operators

What is an expression in the context of variable assignment?

An expression is made up of values and operators that can be evaluated to a value in the program.

p.35
Using printf() Function

What data type is used to store the value of pi in the example?

double

p.18
Variables and Assignment Operators

What does the variable `side` represent in the program?

It represents the length of one side of a square.

p.29
Console Input/Output with scanf() and printf()

What function is used to prompt the user for input?

printf

p.29
Console Input/Output with scanf() and printf()

Which function is used to read an integer from the user?

scanf

p.2
Using printf() Function

What are the two output statements in the provided C program?

"Hello, world!" and "Hello, universe!"

p.16
Variables and Assignment Operators

What value is assigned to 'side' in the program?

3.

p.19
Variables and Assignment Operators

What value is assigned to 'side' in the code?

The value assigned to 'side' is 3.

p.19
Console Input/Output with scanf() and printf()

What is the output of the program for the variable 'area'?

The output for 'area' will be 9.

p.6
Using printf() Function

What is the example output used in the printf() function?

"Hello, world!\n"

p.7
String Constants and Escaped Sequences

What must a string constant be enclosed by in C?

A pair of double-quote characters (" ").

p.20
Using printf() Function

How does printf("Hello world!\n"); differ from printf("Side : %d\n", side);?

The first prints a static string, while the second prints a formatted string with a variable value.

p.37
Variables and Assignment Operators

What is a variable in C?

A variable holds a value, has a name, and a type.

p.30
Console Input/Output with scanf() and printf()

What occurs when scanf() is called?

Execution is paused while scanf() waits for user input.

p.17
Variables and Assignment Operators

What happens when you assign an expression to a variable?

The value of the expression is copied to the variable.

p.16
Variables and Assignment Operators

What formula is used to calculate the area of a square in the program?

side * side.

p.35
Using printf() Function

What is the output of printf() with the format specifier %.6f for the value of pi?

3.141593

p.35
Basic Structure of a C Program

What is the purpose of including <stdio.h> in a C program?

To use input and output functions like printf().

p.36
Console Input/Output with scanf() and printf()

What happens when scanf() encounters invalid input?

It won't work properly, for example, if a user enters an alphabet when an integer is expected.

p.31
Language Syntax and Errors

What format specifier is used to read integers in scanf()?

%d

p.26
Identifiers and Reserved Words

Is 1_1 a valid identifier?

No, it is not a valid identifier.

p.13
Variables and Assignment Operators

What must be done before using variables in a program?

Variables must be declared first.

p.4
Language Syntax and Errors

What is the main error in the provided C code?

The function 'Printf' should be 'printf' (case sensitivity).

p.13
Variables and Assignment Operators

What is the syntax for declaring a single variable?

type1 var1;

p.3
Language Syntax and Errors

Why can't computers follow malformed instructions?

Because they rely on correct syntax to execute commands.

p.12
Data Types and Numeric Constants

What data type is used for the variables 'side', 'perimeter', and 'area'?

int (indicating they store integers).

p.33
Console Input/Output with scanf() and printf()

What is the purpose of the program in Example 5.3?

To read two floating point numbers from the user.

p.16
Basic Structure of a C Program

What is the purpose of the 'main' function in a C program?

It serves as the entry point for program execution.

p.16
Variables and Assignment Operators

How is the perimeter of a square calculated in the program?

By multiplying 4 by the length of one side.

p.37
Console Input/Output with scanf() and printf()

What functions are used for console input/output in C?

scanf() and printf().

p.32
Console Input/Output with scanf() and printf()

What does the format string '%d%d' in scanf() indicate?

It tells scanf() to read two integers.

p.29
Console Input/Output with scanf() and printf()

What does the program output after the user enters the integer 123?

num1 = 123

p.32
Console Input/Output with scanf() and printf()

What is required between the two input values for scanf() to work correctly?

At least one whitespace character.

p.15
Variables and Assignment Operators

What does the variable 'side' represent in the code?

It represents the length of one side of a square.

p.15
Variables and Assignment Operators

What formula is used to calculate the area of the square?

Area = side * side.

p.15
Variables and Assignment Operators

What happens to the variables 'side', 'perimeter', and 'area' immediately after declaration?

Their values are undefined; they are uninitialized.

p.11
Variables and Assignment Operators

What is the purpose of variables in a program?

To store data.

p.8
String Constants and Escaped Sequences

How do you print a double quotation mark in a string constant?

Use the escaped sequence \".

p.3
Language Syntax and Errors

What is syntax in programming languages?

A set of rules that defines the structure of the code, similar to grammar in the English language.

p.20
Using printf() Function

What does the format specifier %d indicate in printf?

It specifies that the corresponding expression's value should be printed as a decimal integer.

p.17
Variables and Assignment Operators

What operator is used to assign a value to a variable in C?

The assignment operator (=).

p.20
Using printf() Function

In the statement printf("Side : %d\n", side);, what does 'side' represent?

It is the expression whose value is supplied to the format string.

p.29
Basic Structure of a C Program

What library is included at the beginning of the C program?

<stdio.h>

p.2
Basic Structure of a C Program

What is the entry point of a C program?

The main() function.

p.37
Variables and Assignment Operators

What is the purpose of the assignment operator in C?

To assign a value to a variable.

p.37
Identifiers and Reserved Words

What is an identifier in C?

A valid name for identifying things in the program.

p.37
String Constants and Escaped Sequences

What does expressing numeric and string constants involve?

Defining fixed values in the program.

p.14
Variables and Assignment Operators

How is the perimeter of a square calculated in the program?

By multiplying 4 by the length of one side.

p.35
Using printf() Function

What does the format specifier %.xf indicate in printf()?

It formats the floating point number with x decimal places.

p.16
Variables and Assignment Operators

What is the output of 'perimeter' when 'side' is 3?

12.

p.15
Basic Structure of a C Program

What is the purpose of the 'main' function in a C program?

It serves as the entry point for program execution.

p.36
Console Input/Output with scanf() and printf()

What assumption can be made about input values in this course?

Input values are always valid unless otherwise stated.

p.15
Using printf() Function

What is the output format used in the printf statements?

It uses the format specifier '%d' for integers.

p.26
Identifiers and Reserved Words

Is printf a valid identifier?

Yes, it is a valid identifier.

p.26
Identifiers and Reserved Words

Is 32bits a valid identifier?

No, it is not a valid identifier because it starts with a digit.

p.28
Console Input/Output with scanf() and printf()

如何從用戶讀取數字?

使用 scanf() 函數。

p.6
Using printf() Function

What is the purpose of the printf() function?

To output a piece of text to the screen.

p.25
Identifiers and Reserved Words

Can you give examples of predefined identifiers in C?

main, printf, scanf.

p.8
String Constants and Escaped Sequences

What escaped sequence is used for a newline in a string constant?

\n.

p.4
Language Syntax and Errors

How do compilers treat whitespace characters during syntax checking?

Compilers usually consider whitespace characters (space, newline, tab) flexibly.

p.2
Overview of C Language

What is the purpose of the #include <stdio.h> directive in a C program?

It includes the standard input-output library for using functions like printf.

p.23
Identifiers and Reserved Words

What must an identifier not be?

It cannot be one of the reserved words.

p.4
Language Syntax and Errors

What is indentation in programming?

Spacing in front of code lines to improve readability.

p.30
Console Input/Output with scanf() and printf()

What must the user do to resume the program after scanf()?

Enter a value followed by pressing the 'Enter' key.

p.35
Using printf() Function

What is the output of printf() with the format specifier %.7f for the value of pi?

3.1415927

p.14
Data Types and Numeric Constants

What data type is used for the variable 'side' in the program?

int (integer).

p.29
Language Syntax and Errors

What format specifier is used to read an integer in scanf?

%d

p.33
Console Input/Output with scanf() and printf()

What does the program output when the user inputs '123' and '456.125'?

r1 = 123.000000, r2 = 456.125000.

p.19
Variables and Assignment Operators

How is the perimeter of a square calculated in the provided code?

Perimeter is calculated as 4 times the length of a side.

p.24
Identifiers and Reserved Words

What is the significance of the reserved word 'volatile'?

It indicates that a variable may be changed unexpectedly.

p.11
Variables and Assignment Operators

What two characteristics define a variable?

A name and a type.

p.20
Using printf() Function

What is the purpose of the format string in printf?

It specifies the text to print and how to format the output.

p.10
Variables and Assignment Operators

如何在程式中使用變數?

通過宣告變數並將值賦給它,然後在程式中引用該變數。

p.34
Data Types and Numeric Constants

What type of numbers have we been using so far in the examples?

Integers (type int).

p.8
String Constants and Escaped Sequences

What does the escaped sequence \t represent?

A tab character.

p.7
String Constants and Escaped Sequences

What is an example of a valid string constant in C?

"Hello World!"

p.30
Console Input/Output with scanf() and printf()

Why is the '&' operator used before the variable in scanf()?

It is necessary to provide the address of the variable where the input will be stored.

p.5
Comments in C

How do line comments in C work?

They begin with // and extend to the end of the line.

p.34
Data Types and Numeric Constants

What does a decimal point signify in numbers?

It makes a big difference in the type of number.

p.18
Variables and Assignment Operators

What is the formula used to calculate the area of the square?

Area is calculated as `side * side`.

p.32
Console Input/Output with scanf() and printf()

Where are the input values stored when using scanf() with '%d%d'?

The first input value is stored in num1 and the second in num2.

p.24
Identifiers and Reserved Words

What reserved word is used for conditional statements in C?

if, else, switch.

p.32
Console Input/Output with scanf() and printf()

What happens when scanf() is waiting for user input?

Execution is paused until the user enters the second value and presses 'Enter'.

p.36
Console Input/Output with scanf() and printf()

What is incorrect about the printf() usage: printf("%f ", 10);?

10 is a value of type int, but %f expects a float.

p.36
Console Input/Output with scanf() and printf()

What is incorrect about the printf() usage: printf("%.2d ", 10);?

.2 does not apply to integers.

p.26
Identifiers and Reserved Words

Is int a valid identifier?

No, it is a reserved word.

p.26
Identifiers and Reserved Words

Is Notell a valid identifier?

Yes, it is a valid identifier.

p.26
Identifiers and Reserved Words

Is v a valid identifier?

Yes, it is a valid identifier.

p.28
Console Input/Output with scanf() and printf()

如何格式化輸出的數字?

使用 printf() 函數中的格式說明符。

p.25
Identifiers and Reserved Words

Why should you avoid using predefined identifiers in your program?

To prevent conflicts with standard library functions and maintain code clarity.

p.4
Language Syntax and Errors

What does the C language's case sensitivity imply?

Identifiers must be used with the correct case; 'Printf' and 'printf' are different.

p.27
Identifiers and Reserved Words

What is one way to maintain consistency in naming variables?

Use underscores (e.g., interest_rate) or camel case (e.g., interestRate).

p.8
String Constants and Escaped Sequences

What is the escaped sequence for a backslash?

\\.

p.3
Language Syntax and Errors

What should you do when a syntax error is found during compilation?

Read the error message carefully for hints to fix your code.

p.18
Basic Structure of a C Program

What is the purpose of the `main` function in a C program?

It serves as the entry point for program execution.

p.29
Data Types and Numeric Constants

What data type is used to declare 'num1' in the program?

int

p.24
Identifiers and Reserved Words

What are reserved words in C language?

Names that have special meaning in the C language.

p.24
Identifiers and Reserved Words

Give an example of a reserved word in C.

auto, break, char, etc.

p.19
Basic Structure of a C Program

What is the purpose of the 'main' function in a C program?

It serves as the entry point for program execution.

p.18
Variables and Assignment Operators

What is the value assigned to `side` in the program?

The value assigned to `side` is 3.

p.15
Variables and Assignment Operators

How is the perimeter of the square calculated in the code?

By multiplying the side length by 4.

p.31
Basic Structure of a C Program

What is the purpose of the 'main' function in a C program?

It serves as the entry point for program execution.

p.26
Identifiers and Reserved Words

Is A100xC200 a valid identifier?

Yes, it is a valid identifier.

p.9
String Constants and Escaped Sequences

What does the string constant '\ is " backslash " and / is " slash"' represent when output on screen?

\ is " backslash " and / is " slash"

p.30
Console Input/Output with scanf() and printf()

What does the format string '%d' in scanf() indicate?

It tells scanf() to read one integer.

p.34
Data Types and Numeric Constants

What are some examples of integers?

0, -100, 2048, 203139, 1000000.

p.37
Language Syntax and Errors

What are the rules that programmers must obey in C?

Syntax.

p.5
Comments in C

How do block comments in C work?

They start with /* and end at the next */ and can span multiple lines.

p.34
Data Types and Numeric Constants

What are some examples of floating point numbers?

0.0, -10.2, 3.1416, .244.

p.35
Using printf() Function

What does the format specifier %.2f do in printf()?

It formats the floating point number to 2 decimal places.

p.18
Variables and Assignment Operators

How is the perimeter of the square calculated in the program?

By multiplying 4 by the value of `side`.

p.35
Using printf() Function

What is the output of printf() with the format specifier %.2f for the value of pi?

3.14

p.14
Using printf() Function

What does the 'printf' function do in the program?

It outputs formatted text to the console.

p.24
Identifiers and Reserved Words

Which reserved word is used for looping in C?

for, while, do.

p.15
Using printf() Function

What does the printf function do in this program?

It outputs the values of side, perimeter, and area to the console.

p.26
Identifiers and Reserved Words

Is _ a valid identifier?

Yes, it is a valid identifier.

p.22
Identifiers and Reserved Words

What are the key concepts for naming variables?

Follow specific rules and conventions to ensure clarity and avoid conflicts.

p.10
Variables and Assignment Operators

什麼是變數?

變數是用來儲存數據的命名空間,可以在程式中使用。

p.27
Identifiers and Reserved Words

What types of names should be avoided in naming conventions?

Names like a, b, c, d, a1, a2, a3, xyz.

p.12
Basic Structure of a C Program

What is the purpose of the 'main' function in a C program?

It serves as the entry point for program execution.

p.30
Console Input/Output with scanf() and printf()

What happens to the input value read by scanf()?

It is stored in the variable num1.

p.4
Language Syntax and Errors

What is the purpose of proper spacing in C programming?

It makes the program easier to read.

p.29
Basic Structure of a C Program

What is the purpose of the 'main' function in a C program?

It serves as the entry point of the program.

p.12
Variables and Assignment Operators

What is the formula used to calculate the area of a square in the program?

side * side.

p.12
Using printf() Function

What does the printf function do in the program?

It outputs formatted text to the console.

p.12
Console Input/Output with scanf() and printf()

What are the values printed for side, perimeter, and area in the example?

Side: 3, Perimeter: 12, Area: 9.

p.12
Variables and Assignment Operators

What does the statement 'side = 3;' do?

It assigns the value 3 to the variable 'side'.

p.29
Console Input/Output with scanf() and printf()

What is the output format specifier used to display 'num1'?

%d

p.14
Variables and Assignment Operators

What is the value assigned to 'side' in the program?

3.

p.19
Using printf() Function

What does the 'printf' function do in this program?

It outputs formatted text to the console.

p.14
Basic Structure of a C Program

What is the significance of the statement 'return 0;' in the program?

It indicates that the program has executed successfully.

p.36
Console Input/Output with scanf() and printf()

What is incorrect about the printf() usage: printf("%d ", 10.0);?

10.0 is a value of type double, but %d expects an integer.

p.31
Console Input/Output with scanf() and printf()

How does the program read user input?

Using scanf() function.

p.31
Basic Structure of a C Program

What is the return value of the main function in this program?

0

p.26
Identifiers and Reserved Words

Is engg1110 a valid identifier?

Yes, it is a valid identifier.

p.26
Identifiers and Reserved Words

Is c a valid identifier?

Yes, it is a valid identifier.

p.34
Data Types and Numeric Constants

What type of numbers do we use if we need decimal places?

Floating point numbers (type double).

p.12
Variables and Assignment Operators

How is the perimeter of a square calculated in the program?

By multiplying 4 by the length of one side.

p.2
Using printf() Function

What does the printf function do in a C program?

It outputs text to the console.

p.2
Basic Structure of a C Program

How are statements executed in a C program?

Sequentially, one after the other.

p.2
Basic Structure of a C Program

What does the return 0; statement signify in a C program?

It indicates that the program has completed successfully.

p.33
Using printf() Function

How many decimal places does printf() print by default for floating point numbers?

6 decimal places.

p.16
Using printf() Function

What does the 'printf' function do in this C program?

It outputs formatted text to the console.

p.14
Variables and Assignment Operators

What is the formula used to calculate the area of the square in the program?

side * side.

p.24
Identifiers and Reserved Words

What does the reserved word 'return' do in C?

It exits a function and optionally returns a value.

p.19
Data Types and Numeric Constants

What is the data type of the variables 'side', 'perimeter', and 'area'?

All are of type 'int'.

p.31
Using printf() Function

What function is used to display a message to the user?

printf()

p.31
Console Input/Output with scanf() and printf()

What does the program output after reading two integers?

num1 and num2 values.

p.26
Identifiers and Reserved Words

Is URL a valid identifier?

Yes, it is a valid identifier.

p.26
Identifiers and Reserved Words

Is Int a valid identifier?

Yes, it is a valid identifier (case-sensitive).

p.26
Identifiers and Reserved Words

Is ~ a valid identifier?

No, it is not a valid identifier.

p.33
Variables and Assignment Operators

What data type are the variables r1 and r2 in the program?

double.

p.33
Language Syntax and Errors

What format specifier is used in scanf() for double-typed values?

%lf.

p.33
Language Syntax and Errors

What format specifier is used in printf() for double-typed values?

%f.

p.2
Basic Structure of a C Program

What is the significance of the curly braces {} in a C program?

They define the start and end of a block of code.

p.24
Identifiers and Reserved Words

What is the purpose of reserved words?

They are used to perform specific functions in the C language.

p.18
Variables and Assignment Operators

What is the final value of `perimeter` after the calculation?

The final value of `perimeter` is 12.

p.16
Variables and Assignment Operators

What is the output of 'area' when 'side' is 3?

9.

p.19
Variables and Assignment Operators

How is the area of the square calculated in the code?

Area is calculated as side multiplied by itself (side * side).

p.14
Overview of C Language

How are the statements executed in the program?

Sequentially, one by one.

p.36
Console Input/Output with scanf() and printf()

What is incorrect about the printf() usage: printf("% d % d ", 10);?

One argument is omitted.

p.26
Identifiers and Reserved Words

Is Domain-name a valid identifier?

No, it is not a valid identifier due to the hyphen.

p.26
Identifiers and Reserved Words

Is main a valid identifier?

Yes, it is a valid identifier.

p.26
Identifiers and Reserved Words

Is include a valid identifier?

No, it is a reserved word.

p.26
Identifiers and Reserved Words

Is cost a valid identifier?

Yes, it is a valid identifier.

p.18
Using printf() Function

What does the `printf` function do in this program?

It outputs the values of `side`, `perimeter`, and `area` to the console.

p.24
Identifiers and Reserved Words

Name a reserved word that indicates a data type in C.

int, float, double, etc.

p.18
Variables and Assignment Operators

What is the final value of `area` after the calculation?

The final value of `area` is 9.

p.14
Console Input/Output with scanf() and printf()

What does the program output when executed?

It outputs the side, perimeter, and area of the square.

p.31
Basic Structure of a C Program

What library is included at the beginning of the C program?

<stdio.h>

p.31
Data Types and Numeric Constants

What data types are used for 'num1' and 'num2' in the program?

int (integer).

p.26
Identifiers and Reserved Words

Is _1_abc_1_ a valid identifier?

Yes, it is a valid identifier.

p.26
Identifiers and Reserved Words

Is _ 27 a valid identifier?

No, it is not a valid identifier due to the space.

p.26
Identifiers and Reserved Words

Is www_yahoo_com a valid identifier?

Yes, it is a valid identifier.

p.19
Basic Structure of a C Program

What does 'return 0;' signify in the main function?

It indicates that the program has executed successfully.

p.26
Identifiers and Reserved Words

Is engg_1110 a valid identifier?

Yes, it is a valid identifier.

p.26
Identifiers and Reserved Words

Is VARIABLE a valid identifier?

Yes, it is a valid identifier.

p.26
Identifiers and Reserved Words

Is Hong Kong a valid identifier?

No, it is not a valid identifier due to the space.

Study Smarter, Not Harder
Study Smarter, Not Harder