Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
13 views

Notes of Lesson 6 Introduction of C Programming

Chapter 6 introduces C programming, covering fundamental concepts such as variables, data types, and the use of functions like printf(). It includes fill-in-the-blank questions, true/false statements, matching exercises, and multiple-choice questions to reinforce understanding. The chapter emphasizes the importance of C as a general-purpose language and its advantages in learning other programming languages.

Uploaded by

optimus041210
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Notes of Lesson 6 Introduction of C Programming

Chapter 6 introduces C programming, covering fundamental concepts such as variables, data types, and the use of functions like printf(). It includes fill-in-the-blank questions, true/false statements, matching exercises, and multiple-choice questions to reinforce understanding. The chapter emphasizes the importance of C as a general-purpose language and its advantages in learning other programming languages.

Uploaded by

optimus041210
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Chapter 6: Introduction of C Programming (Notes)

Q. 1 Fill in the blanks.


1) C is a general-purpose programming language created by Dennis Ritchie.
2) A Compiler is used to translate the C code into a language that the computer
will understand.
3) printf() is a function used to print text to the screen.
4) Variables are containers for storing data values, like numbers and characters.
5) Float is used to store floating point numbers, with decimals.

Q.2 Identify true or false and rewrite the correct statement


1) To insert a new line, you can use the \n character.
Ans: True
2) Int data type Stores a single character, letter, number.
Ans: False- Char data type stores a single character, letter, number.
3) Return 0 ends the printf() function.
Ans: False- Return 0 ends the main() function.
4) To change existing variable values, you can use the const keyword.
Ans: True

Q.3 Match the following


Group A Group B
1) #include <stdio.h> ans: b) a)To show the value of float variable
2) Int data type ans: c) b) Header file library
3) %f format specifier ans: a) c) Stores 2 or 4 bytes of data.

Q. 4 Multiple choice question.


1) ___is a general-purpose programming language created by Dennis Ritchie.
a) C++ b) C c) Python d) Java
2) _____is called a function. Any code inside its curly brackets { } will be executed.
a) printf() b) <stdio.h> c) main() d) return 0
3) The value of an int variable, use the format specifier as ___ surrounded by double quotes.
a) %c b) %f c) %i d)%d

Q. 5 Answer in one sentence.


1) What are variables?
Ans: Variables are containers for storing data values, like numbers and characters.
2) What is the use of format specifier?
Ans: Format specifiers are used together with the printf() function to tell the
compiler what type of data the variable is storing.
3) What is data type?
Ans: The data type is a collection of data with values having fixed values,
meaning as well as its characteristics.
4) What is the use of printf() function?
Ans: printf() is a function used to print text to the screen.

5) What is a header file library?


Ans: #include<stdio.h> is a header file library that lets us work with input and
output functions, such as printf(). Header files add functionality to C programs.

Q.6 Answer in short


1) What are statements? Explain with an example?
Ans: A computer program is a list of "instructions" to be "executed" by a
computer.
In a programming language, these programming instructions are called statements.

The following statement "instructs" the compiler to print the text "Hello World" to
the screen.
Eg: printf("Hello World!");

2) Explain different types of variables in C?


Ans: i)int -It stores integers (whole numbers), without decimals, such as 123 or -
123
ii)float – It stores floating point numbers, with decimals, such as 19.99 or -19.99
iii)char – It stores single characters, such as 'a' or 'B'. Char values are surrounded
by single quotes.

3) Write a short note on format specifer?

Ans: Format specifiers are used together with the printf() function to tell the
compiler what type of data the variable is storing. A format specifier starts with a
percentage sign %, followed by a character.

For example, to output the value of an int variable, use the format
specifier %d surrounded by double quotes, inside the printf() function:
Example:
int myNum = 15;
printf("%d", myNum); // Output 15
4) Write advantage and disadvantages of C language?

5) What is C? Why to learn C language?

Ans: C is a general-purpose programming language created by Dennis Ritchie at


the Bell Laboratories in 1972

 If you know C, you will have no problem learning other popular programming
languages such as Java, Python, C++, C#, etc, as the syntax is similar.
 C is very fast, compared to other programming languages, like Java and
Python.
 C is very versatile; it can be used in both applications and technologies.

You might also like