10th Class Computer New Course ITP Unit-01
Q.1 Multiple choice questions.
- A software that facilitates programmers in writing computer programs is known as ____________________.
a) a compiler
b) an editor (Correct Answer)
c) an IDE
d) a debugger
2. ____________________ is a software that is responsible for the conversion of program files to machine understandable and executable code.
a) Compiler (Correct Answer)
b) Editor
c) IDE
d) Debugger
3. Every programming language has some primitive building blocks and follows some grammar rules known as its ____________________.
a) Programming rules
b) syntax (Correct Answer)
c) building blocks
d) semantic rules
4. A list of words that are predefined and must not be used by the programmer to name his own variables are known as ____________________.
a) auto words
b) reserved words (Correct Answer)
c) restricted words
d) predefined words
5. Include statements are written in ____________________ section.
a) header (Correct Answer)
b) main
c) comment
d) print
6. ____________________ are added in the source code to further explain the techniques and algorithms used by the programmer.
a) Messages
b) Hints
c) Comments (Correct Answer)
d) Explanations
7. ____________________ are the values that do not change during the whole execution of program.
a) Variables
b) Constants (Correct Answer)
c) Strings
d) Comments
8. A float uses ____________________ bytes of memory.
a) 3
b) 4 (Correct Answer)
c) 5
d) 6
9. For initializing a variable, we use ____________________ operator.
a) →
b) = (Correct Answer)
c) @
d) ?
10. ____________________ can be thought of as a container to store constants.
a) Box
b) Jar
c) Variable (Correct Answer)
d) Collection
Q.2 True or False
- An IDE combines text editors, libraries, compilers and debuggers in a single interface.
True
2. Computers require the conversion of the code written in program file to machine language in order to execute it.
True
3. Column is a reserved word in C programming language.
False
4. *command goes here* is a valid comment.
False
5. Float can store a real number upto six digits of precision.
True
Q.3 Define the following.
1) IDE
An IDE has a Graphical User Interface (GUI), meaning that a user can interact with it using windows and buttons to provide input and get output. AN IDE consists of tools that help a programmer throughout the phases of writing, executing and testing a computer program. This is achieved by combining text editors, compilers and debuggers in a single interface.
2) Compiler
A compiler is a software that is responsible for conversion of a computer program written in some high level programming language to machine language code.
3) Reserved Words
Every programming language has a list of words that are predefined. Each word has its specific meaning already known to the compiler. These words are known as reserved words or keywords.
4) Main section of a program
It consists of a main() function. Every C program must contain a main() function and it is the starting point of execution.
5) char data type
To declare character type variables in C, we use the keyword char. It takes up just 1 byte of memory for storage. A variable of type char can store one character only.
Q.4 Briefly answer the following questions.
1) Why do we need a programming environment?
Answer: Need of programming environment
We need programming environment to facilitate programmers for writing and executing computer programs. For this we need Integrated Development Environment (IDE) which consists of tools that help a programmer throughout the phases of writing, executing and testing a computer program.
3) Describe the purpose of a compiler.
Answer: Purpose of Compiler
Computers only understand and work in machine language consisting of 0s and 1s. They require the conversion of a program written in programming language, in order to execute it. This is achieved using a compiler.
4) List down five reserved words in C programming language.
Answer: Five reserved words in programming language.
- Auto
- Break
- Case
- Char
- Const
5) Discuss the main parts of the structure of a C program.
Answer: There are three main parts of a program
- Link section or header section: While writing programs in C language, we make extensive use of functions that are already defined in the language. But before using the existing functions, we need to include the files where these functions have been defined. These files are called header files. We include these header files in our program by writing the include statements at the top of program.
Syntax: #include<header_file_name>
2. Main section: It consists of a main() function. Every C program must contain a main() function and it is the starting point of execution.
3. Body of main function: The body of main() is enclosed in the curly braces {}. All the statements inside these curly braces make the body of main function.
6) Why do we use comments in programming?
Answer: Uses of comments
Comments are the statements in a program that are ignored by the compiler and do not get executed. Comments ban be thought of as documentation of the program. Their purpose is twofold.
- They facilitate other programmers to understand our code.
- They help us to understand our own code even after years of writing it.
7) Differentiate between constants and variables.
Answer: Difference between constants and variables
Constants are the values that cannot be changed by a program while a variable is a name given to a memory location, and the value of a variable can be changed in program.
8) Write down the rules for naming variables.
Answer: Rules for naming variable
Each variable must have a unique name or identifier. Following rules are used to name a variable.
- A variable name can only contain alphabets (uppercase or lowercase), digits and underscore (_) sign.
- Variable name must begin with a letter or an underscore, it cannot begin with a digit.
- A reserved word cannot be used as a variable name.
There is no strict rule on how long a variable name should be, but we should choose a concise length for variable name to follow good design practice.
10) How can we declare and initialize variable?
Variable Declaration:
We need to declare a variable before we can use it in the program. Declaring a variable includes specifying its data type and giving it a valid name.
Syntax: data_type variable_name;
Variable Initialization
Assigning value to a variable for the first time is called variable initialization. C language allows us to initialize a variable both at the time of declaration, and after declaring it.
Syntax: data_type variable_name = value;
e.g. int x = 5;

10th Class Computer Unit-05: Functions

10th Class Computer New Course Data & Repetition Unit-04
10th Computer New Course Conditional Logic Unit-03
10th Class Computer New Course User Interaction Unit-02
9th Computer New Course Designing Website Unit-05
9th Computer New Course Data and Privacy Unit-04
9th Computer New Course Networks Unit-03
9th Computer New Course Binary System Unit-02
9th Computer New Course Problem Solving Unit-01
Buy Best Stationery Products in Pakistan
For more stationery items please visit : https://stationerystore.pk