0% found this document useful (0 votes)
67 views

Computer Class 10

Uploaded by

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

Computer Class 10

Uploaded by

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

CENTRAL

ACADEMY

COMPUTER
Class TEN
CHAPTER 1
INTRODUCTION TO PROGRAMMING
Important Short Questions
Q1: What is integrated development environment (IDE)?
Ans. A software that provides a programming environment to facilitate programmers in writing and
executing computer program is known as an integrated development environment (IDE). Some of the
many available IDEs for C programming language are:
1. Visual Studio 2. Xcode 3. Code::Blocks
Q2: Describe the purpose of a compiler.
Ans. 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. The generated machine code can
be later executed. A compiler first reads the whole program before executing it.
Q3: What is meant by computer programming?
Ans. The process of feeding or storing instructions in the computer is known as computer
programming. Computer programming is a problem solving activity.
Q4: Define computer program.
Ans. Computer need to be fed a series of instructions by humans which tell them how to perform a
particular task. These series of instructions are known as a computer program or software.
Q5: What are reserved words?
Ans. Every programming language has 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. e.g
int, for etc.
Q6: Write the purpose of comments in "C" language.
Ans. Comments can be thought of as documentation of the program. Their purpose is two fold:
o They facilitate other programmers to understand our code.
o They help us to understand our own code even after years of writing it.

Q7: Define syntax.


Ans. Every programming language has some primitive building blocks and follows some grammar
rules known as it syntax. If we do not follows the syntax of a programming language, it gives syntax
error.
Q8: Why do we use comments in programming?
Ans. Comments are the statements that are ignored by the compiler and do not get executed. To
include additional information about the program, comments can be used. e.g // This is a comment.
Q9: Define constant.
Ans. Constants are the values that do not change. The three types of constants are integer constants,
real constants and character constants.
Q10: Write down the two rules for naming a variable.
Ans. Each variable must have a unique name or identifier. Following are the two rules for naming a
variable.
A reserved word cannot be used as a variable name.
Variable name must begin with a letter or an under score. It cannot begin with a digit.
Q11: What is variable?
Ans. Variable is a name given to a memory location as the data is physically stored inside the
computer's memory. Each variable has a unique name by which we can refer to that variable, and an
associated data type that describes the type of constant that can be stored in that variable.
Q12: How can we declare a variable?
Ans. A variable must be declared before its use. Variable declaration included specifying variable's
data type and giving it a valid name. Following syntax can be followed to declare a variable: data-type
variable-name; e.g. float height;
Q13: Write the name of Two Data Types used in C-Language.
Answer: The names of two data types used in C-Language are as follows:
1. int 2. Char
CHAPTER 2
USER INTERACTION
Important Short Questions
Q1: Write the purposes of escape sequence.
Answer: Escape sequence forces printf ( ) to escape from its normal behavior. It is the combination of
escape character (\) and a character associated with special functionality.
Example:
Printf (“Name:\t Ali\n Father na:e\t Ahmad”);
Q2: Why "getch ()" function is used at the end of program?
Ans. We use "getch( )" function at the end of program because this function is generally used and hold
the execution of program and the program does not continue further until the user type a key. This
function is used to read a character from user. To use this function, we need to include the library
conio.h in the header section of program.
Example: getch ( );
Q3: Define statement teminator.
Ans. A statement terminator is identifier for compiler which identifies end of a line. In C language
semicolon (;) is used as statement terminator. If we do not end each statement with a semicolon (;) it
results into error. e.g Printf ("Hello")
Q4: Differentiate between "char" and "int".
Answer:
Char Int
Data type "char" is used to store character data. Data type "int" is used to store integer type data.
Example: char b='a'; Example: int a = 50;
It takes up to 1 byte of memory for storage. It takes up to 4 bytes of memory for storage.

Q5: What is the difference between printf( ) and scanf ( )?


Ans.
Printf( ) Scanf( )
printf is a built-in function in C programming scanf is a built-in function in C language that
language. Its name comes from "print formatted" takes input from user into a variable. e.g
that is used to show the formatted output on scanf("%f", & radius);
screen.

Q6: What is assignment operator?


Ans. Assignment operator is used to assign a value to a variable, or assign a value of variable to
another variable. Equal sign (=) is used as an assignment operator in C language.
Example: A = 50;
Q7: Define the modulus operator.
Ans. Modulus operator is a binary operator, which performs division of left operand to the right
operand and return the remainder value after division. Modulus operator works on integer data types.
For example.
int ans = 17 % 3;
Q8: What is the use of relational operators?
Ans. Relational operators compare two values to determine the relationship between values. These
operators identify either the values are equal, not equal, greather than or less than from one another. C
language allows us to perform relational operations on numeric and char type data. e.g > , < = = etc.
Q9: What is meant by precedence of operators? Which operator has the highest precedence in
C-Language?
Ans. An operators precedence determines its order of evaluation in an expression. If there are multiple
operators in an expression, the question arises that which operator is evaluated first. To solve this
issue, a precedence has been given to each operator. Operator ( ) has highest precedence in C-
language.
Q10: Define logical operators.
Ans. Logical operators perform operations on Boolean expressions and produce a Boolean expression
as a result. There are three types of logical operators in C-language:
Logical AND operator Logical OR operator Logical NOT operator
Q11: Differentiate between unary operators and binary operators.
Ans. Difference between Unary operators and Binary Operators:
Unary Operators Binary Operators
Unary operators are applied over one operand Binary operators are applied over two operands
only to perform the operation. to perform the operation.
e.g: Logical NOT (!) operator e.g.: Logical AND (&&) and Logical OR (| |)
operators.

Q12: Define operators.


Ans. Operators are symbols which are used to perform certain operations on data. C-language offers
numerous operators to manipulate and process data. e.g. Arithmetic operators, Logical operators,
Relational operator and Assignment operator.
Q13: What is the difference between == operator and = operator?
Answer: In C language, = = operator is used to check for equality of two expressions, whereas =
operator assigns the result of expression on right side to the variable on left side. Operator (==) checks
whether right and left operands are equal or not. (=) operator assigns right operand to the variable on
left side.
Q14: Write the structure of "if" statement.
Ans. The structure of "if" statement is as follows:
if (condition)
Associated code
CHAPTER 3
CONDITIONAL LOGIC
Important Short Questions
Q1: What is sequential control?
Ans. Sequential control is the default structure in a language. According to sequential control, all the
statements are executed in the given sequence. Simple programs follow the sequential control.
Q2: List types of control statement.
Ans. Control statements control the flow of execution of a program. There are three types of control
statements in C language:
o Sequential control statements
o Selection control statements
o Repetition control statements
Q3: Write the purpose of if statement.
Ans. It is a decision making statement, depending upon the decision, it can change the order of
program execution. It is used to select a path flow in a program based on a condition. A condition is an
expression that either evaluates to true or false.
Q4: Define selection statement.
Ans. The statement which helps us to decide which statement should be executed next, on the basis of
condition, is called selection statement. There are two types of selection control statements.
o if statement
o if-else statement
Q5: Write syntax of "If else" statement.
Ans. General syntax of 'If-else" statement is as follows:
if(condition)
Associated code
else
Associated code
Associated code of if statement is executed if the condition is true, otherwise the code associated with
else statement is executed.
Q6: Differentiate between "if statement" and "if-else statement".
Ans. Difference between if statement and if-else Statement:
If statement If-else statement
In if statement we specify a condition, and An if-else statement executes the set of
associate a code to it. The code get executed if statements under if statement if the condition is
the specified condition turns out to be true, true and executes the set of statements under else
otherwise the code does not get executed. otherwise.
Q7: What is the use of nested selection structure?
Answer: Selection statements within selection statements are called nested selection structure. The
code associated with an if statement or with an else statement can be any valid C language set of
statements. It means that inside an if block or inside an else block, we can have other if statements or
if-else statements.
Q8: Define compound statement.
Ans. A set of multiple instructions enclosed in braces { } is called a block or a compound statement.
Q9: Make flow chart of if…. Else statement.
Answer: Flow chart of if….else statement is as follows:

Q10: Write the structure of if statement.


Answer: The structure of if statement is as follows:
If (condition)
Associated code
Chapter 4
Data and Repetition
Q1: Write the syntax of array declaration.
Ans. In C-language, an array can be declared as follows:
data_type array_name [array_size]
In the above structure:
o array_name: Represents the identifier of an array.
o [array_size]: Represents the maximum number of elements that can be stored in an array.
Q2: What is array?
Ans. An array is a data structure that can hold multiple values of same data type. It stores all the
values at contiguous locations inside the computer's memory. e.g. an int array can hold multiple
integer values.
Q3: Define data structure.
Ans. Data structure is a container to store collection of data items in a specific layout. Different data
structures are available in C programming language. Array is one of them. An array is one of the most
commonly used data structure.
Q4: What is meant by "Array initialization"?
Ans. Assigning values to an array for the first time, is called array initialization. An array can be
initialized at the time of declaration. It can be done in the following manner:
data-type array-name[N] = {value1, value2,….. value N};
Q5: How does an array differ from simple variable?
Ans. Difference between simple variable and array:
Simple variable Array
Simple variable can hold single value. Variable An array is a data structure that can hold
is a name given to a memory location to store multiple values of same data type. It stores all
the data. the values at contiguous location inside the
computer memory.

Q6: What do know about the index of an array?


Ans. Each element of an array has an index that can be used with the array name as array-name
[Index] to access the data stored at that particular index. Variables can also be used as array indexes.
Q7: Write the one use of an array.
Ans. An array is a data structure that can hold multiple values of same data type. It stores all the
values at contiguous locations inside the computer's memory. e.g. an int array can hold multiple
integer values.
Q8: Write down the structure of "for" loop.
Ans. For loop is used to execute set of statements up to fixed number of times. In C programming
language, for loop has the following general syntax:
for (initialization; condition; increment/decrement)
{
Code to repeat
}
Q9: How many types of loops are there in C language? Write down their names.
Ans. Loop structure is used to repeat a set of statements. There are three type of loop in C-language:
o for loop
o while loop
o do while loop

Q10: Define nested loop.


Ans. When we use a loop inside another loop, it is called nested loop structure. We use nested loops to
repeat pattern multiple times.
Q11: Define loop.
Ans. Loop structure is used to repeat a set of statements.
Q12: Draw the flow chart of “For Loop”/
Answer:
Chapter 5
Functions
Important Short Questions
Q1: What is meant by built-in functions?
Answer: The functions which are available in C standard library are called built-in functions. These
functions perform commonly used mathematical calculations, string operations, Input/Output
operations etc. for example printf( ), scanf( ) are built-int functions.
Q2: What do you know about the “return” keyword?
Answer: Inside the function, return is a keyword that is used to return a value to the calling function.
When the return statement is executed, expression is evaluated and returned as the value of the
function. Execution of the functions stops when return statement is executed, even if there are other
statements still remaining in the function body, e.g., return (a + b);
Q3: Write the procedure to call a function.
Answer: To use a function we have to call it. Calling a function means to transfer the control to the
particular function. We need to call a function, so that it performs the programmed task. We can call a
user defined function from another user defined function, same as we call other functions in main
function. Following is the general structure used to make a function call:
Function-name (value1, value2, ….. value n);
Example: printf(“%d”, add (4,5);
Q4: Define functions.
Ans. A function is a block of statements that performs a particular task. For example, printf is a built-
in function that is used to display anything on computer screen. There are two types of functions:
 Built-in functions
 User defined functions
Q5: What is meant by "reusability"?
Ans. Functions provide reusability of code. It means that whenever we need to use the functionality
provided by the function, we just call the function, we do not need to write same set of statements
again and again.
Q6: What are user defined functions?
Ans. The functions which are defined by a programmer are called user defined functions. These
functions are defined only for the life of a given program and are not part of the C-language.
Q7: What is the difference between arguments and parameters?
Ans. Difference between Arguments and Parameters:
Parameters
Parameters are variables of different data to types, that are used to receive the values passed to the
function as input.
Arguments
During the function call, the values passed to the function are called arguments.
Q8: What are parameters in functions?
Ans. Parameters are variables of different data types that are used to receive the values passed to the
function as input. A function can have multiple parameters but it cannot return more than one values.
Q9: What is function body?
Ans. Body of the function is the set of statements which are executed in the function to fulfil the
specified task. Just after the function's signature, the set of statements enclosed inside { } form the
body of the function.
Q10: How many values a function can return?
Ans. A function can only return one value. There may be multiple return statements in a function but
as soon as the first return statement is executed, the functions call returns and further statements in the
body of the function are not executed.
Q11: Write two advantages of function.
Ans. Functions provide us several advantages, two of the main advantages of function are as follows:
Reusability
Separation of tasks
Q12: Write the two basic types of functions.
Ans. There are two types of functions:
Built-in functions
User define functions

You might also like