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

I2_ShortQuestions_UpdatedSeptember2023

The document provides a comprehensive overview of data basics, including definitions of data, information, data processing, and various database concepts such as files, records, and keys. It also discusses the importance of database management systems (DBMS), data integrity, redundancy, and the roles of data administrators. Additionally, it covers the database design process, including analysis, relationships, cardinality, and the components of Entity-Relationship (ER) diagrams.

Uploaded by

Maqbool Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

I2_ShortQuestions_UpdatedSeptember2023

The document provides a comprehensive overview of data basics, including definitions of data, information, data processing, and various database concepts such as files, records, and keys. It also discusses the importance of database management systems (DBMS), data integrity, redundancy, and the roles of data administrators. Additionally, it covers the database design process, including analysis, relationships, cardinality, and the components of Entity-Relationship (ER) diagrams.

Uploaded by

Maqbool Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

I2 Past Papers’ Short Questions Chapter 1 Data Basics

Chapter 1: Data Basics


Q. 1 What is the difference between Data and Information? (4 times)
Ans. Data is a collection of facts, figures, and statistics related to an object. On the other hand
information is the process form of data. Moreover, data is meaningless and information is meaningful.
Q. 2 Define Data Processing. (2 times)
Ans. The process of manipulating data to achieve the required objectives and results to called data
processing. The software is used to process raw data. The software converts raw data into meaningful
information.
Q. 3 List different activities in data processing.
Ans. Different activities involved in data processing are data capturing, data manipulation and
managing output results.
Q. 4 Describe Data Manipulation. (2 Times)
Ans. The process of applying different operations on data is called data manipulation. It includes the
operations of classifying, calculations, sorting and summarizing.
Q. 5 Define Field.
Ans. A field is a combination of one or more characters. It is the smallest unit of data that can be
accessed by the user. Each field contains one specific piece of information For example, employee no,
designation and salary are fields.
Q. 6 What is the difference between Record and Field?
Ans. A field is a combination of one or more characters. It is the smallest unit of data that can be
accessed by the user. Each field contains one specific piece of information For example, employee no,
designation and salary are fields. A collection of related fields treated as a single unit is known as
record. For example, a employee's record includes a set of fields about the employee such as Employer
Number, Employee Name, Grade and Designation etc.
Q. 7 What is the File?
Ans. A collection of related records treated as a single unit is known as file. Files are stored in disk like
hard disk, CD-ROM or DVD-ROM etc.
Q. 8 List the file types from usage of point of view.
Ans.
• Master File: Master files are used to store the information that remains constant for a long period
of time.
• Transaction File: A type of file that is used to store input data before processing is called
transaction file.
• Backup File: A type of file that is used to take backup important data is called backup file. It is
used to store an additional copy of data.
Q. 9 What do you mean by file organisation? (3 times)
Ans. A technique for physically arranging the records of a file on secondary storage devices is called
file organization.
Q. 10 What are sequential files?
Ans. The records in sequential file organization are stored in sequence. The sequence means the
records are stored one after the other. The records can be retrieved only in the sequence in which they
were stored. The principal storage media for sequential files is magnetic tape.
Q. 11 What is Direct Access File and Sequential Access File?
Ans. Records in direct file organization are not stored in a particular sequence. A key value of a record
is used to determine the location to store the record. Each record is accessed directly without going
through the preceding records. The records in sequential file organization are stored in sequence. The
sequence means the records are stored one after the other. The records can be retrieved only in the
sequence in which they were stored.
Q. 12 What is Database? (2 times)

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 1


I2 Past Papers’ Short Questions Chapter 1 Data Basics

Ans. A database is a collection of logically related data sets or files. Each file may contain different
type of information and are used for specific purposes. The files may be organized in different ways to
meet different processing and retrieval requirements of the users.
Q. 13 What is Database System?
Ans. A database system is a collection of data as well as programs required to manage that data. A
database system is a computerized record-keeping system. The main purpose of this system is to
maintain data and provide it to the user when it is required.
Q. 14 Why do people use database?
Ans. People use databases to retrieve the data quickly and easily. Database can store large amount of
data efficiently. It allows the user to display and distribute data is many ways.
Q. 15 List two examples of Database systems.
Ans. Any two from the following.
• A system that maintains component part details for a car manufacturer.
• A training company keeping course information and participants' details.
• An organization maintaining all sales order information.
Q. 16 Name four major components of database system.
Ans. The four major components of database system are data, hardware, software and personnel.
Q. 17 What is DBMS? Please define.
Ans. A database management system is a collection of programs that are used to create, maintain and
access database in a convenient and efficient manner. DBMS uses database manager software to control
the overall structure of a database.
Q. 18 Write some objectives of DBMS. (2 times)
Ans. Some important objectives of database management system are shareability, availability,
evolvability and database integrity.
Q. 19 Define the term Data Integrity. (2 times)
Ans. Data integrity means the reliability and accuracy of data.
Q. 20 What is meant by the database integrity? (2 times)
Ans. Database integrity means the correctness and consistency of data. It is another form of database
protection. Security means data must be protected from unauthorized operations.
Q. 21 What is meant by Redundancy? (4 times)
Ans. Redundancy means duplication of data in multiple files. It is a type of problem that exists in
relations. It is created when the same information is unnecessarily stored in two different ways or forms.
Q. 22 Differentiate between Data Redundancy and Data Inconsistency.
Ans. Data redundancy means the duplication of data in multiple files. Data inconsistency leans two
files may contain different data of the same entity.
Q. 23 What do you understand by Data Independence?
Ans. Data independence means that data and application programs are separate from each other. The
user can change data storage structures and operations without changing the application programs. The
user can also modify programs without reorganization of data.
Q. 24 Define Entity. (4 times)
Ans. An entity is anything about which information is stored in the database. The entity must have a
unique identifier. The identifier is composed of one or more attributes.
Q. 25 What is meant by Access Security?
Ans. Access security refers to the protection of database from unauthorized access. It may include
password and access restrictions. Database management system provides the facility of access security.
Q. 26 What is Data Dictionary?
Ans. Data dictionary is used to store data definitions or description of the structure of data used in
database. It may also monitor the data that is entered. It ensures that data is according to the data
definition rules.
Q. 27 Distinguish between File Processing and Database approach.
Ans. In file processing, data may be duplicated in different files that cause data redundancy. It is
difficult to apply data integrity checks on files. The programs and data are inter-dependent. In database
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 2
I2 Past Papers’ Short Questions Chapter 1 Data Basics

approach, data is not duplicated and appears only once. It provides many constraints for data integrity.
The programs and data are independent of each other.
Q. 28 Define the term DDL.
Ans. DDL stands for Data Definition Language. It consists of SQL commands used to define a
database, creating tables, indexes and views. Some important commands of DDL include
CREATE/DROP TABLE, ALTER TABLE, CREATE/DROP VIEW etc.
Q. 29 State the purpose of feasibility study.
Ans. Feasibility study is conducted to investigate required database system. It determines
whether the proposed system is affordable, possible and acceptable. It also involves the
identification and selection of area.
Q. 30 Why is report generator used in database system?
Ans. A report generator is used to produce reports. It retrieves data from a database and displays it in
different formats. The report format can be specified in advance such as row heading, column heading
and page heading etc.

Long Questions
Q. 1 What is a file? Explain three types of files from usage point of view.
Q. 2 What is file? Describe how do we organise files on storage media?
Q. 3 Define Database. Describe the different database models.
Q. 4 Define Database System. Describe four major components of database system in detail. (2 times)
Q. 5 What is Database? Define RDMBS? Also discuss the advantages and disadvantages of database
management system.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 3


I2 Past Paper Short Questions Chapter 2 Basic Concepts and Terminologies of Database

Chapter 2
Basics Concepts and Terminologies of Database
Q. 1 What is the usage of index in FMS and DBMS? / Define the term Index.
Ans. An index is a data structure that is used by DBMS to locate a particular record in a file more
quickly. Indexes are used to speed up the sorting and searching process. The performance of database is
improved with these indexes.
Q. 2 How a relation is formed in database?
Ans. The relations are formed according to the attributes of entity about which information is to be
stored. The attributes of the entity become the fields of the relation. The name of the entity becomes the
name of the relation
Q. 3 Write the properties of a Relation. (5 times)
Ans. No Duplicate Rows Exist
The Order of Rows is Insignificant
The Order of Columns is Insignificant
Columns/Attributes are all Elemental or Atomic
Q. 4 What is the purpose of using views? (2 times)
Ans. A view is also known as virtual table. The basic purpose of using views is to keep data safe and
secure from unauthorized and illegal users. A view can also display records from multiple tables. The
views provide more flexibility and security in displaying data.
Q. 5 What is a Key? / Why are keys defined in tables? (2 Times)
Ans. A key is an attribute or set of attributes that uniquely identifies a tuple in a relation. The keys are
defined in tables to access or sequence the stored data quickly and smoothly. They are also used to
create relationship between different tables.
Q. 6 List any two types of Keys.
Ans. Primary Key, Foreign Key, Secondary Key.
Q. 7 Define Primary Key. (2 times)
Ans. The attribute or combination of attributes that uniquely identifies a row or record in a relation is
known as primary key. A relation can have only one primary key. Primary key cannot contain null
values.
Q. 8 Write any two important characteristics of Primary Key.
Ans. Write any two from the following.
• A relation can have only one primary key.
• Primary key cannot contain null values.
• Primary key must have the unique value.
Q. 9 What is Candidate Key? Define Candidate key. (3 times)
Ans. A relation may contain many attributes or combination of attributes that can be used as primary
key. The attribute or combination of attributes that can be used as primary key is known as candidate
key. The candidate keys that are not selected as primary key are known as alternate keys.
Q. 10 Differentiate between Primary key and Candidate key?
Ans. A primary key is an attribute or combination of attributes that uniquely identifies a row in a
relation. When a relation has more than one such attribute or combination of attributes that can be used
as primary key, each is called a candidate key
Q. 11 Define Alternate Key.
Ans. A relation may contain many attributes or combination of attributes that can be used as primary
key. The attribute or combination of attributes that can be used as primary key is known as candidate
key. The candidate keys that are not selected as primary key are known as alternate keys.
Q. 12 What is the use of Foreign Key?
Ans. A foreign key is an attribute or combination of attributes in a relation whose values match a
primary key in another relation. The table in which foreign key is created is known as dependent table.
The table to which the foreign key refers is known as parent table.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 4
I2 Past Paper Short Questions Chapter 2 Basic Concepts and Terminologies of Database
Q. 13 Distinguish between Primary Key and Foreign Key. (2 times)
Ans. A primary key uniquely identifies each row in a relation. A foreign key is an attribute or set of
attributes in a relation that reference a primary key in another table.
Q. 14 Describe the use of Control/Sort Key.
Ans. An attribute or set of attributes that is used to physically sequence the stored data is called sort
key. It is also known as control key. The stored data can be sorted in different ways according to user
requirements.
Q. 15 Who is Data Administrator? (2 times)
Ans. A data administrator is a person who is responsible for entire data of an organization. He
normally develops the overall functional requirements for the database being used in the office. He
controls and manages the whole database system.
Q. 16 Write two responsibilities of Data Base Administrator. (2 times)
Ans. Two responsibilities of a database administrator include assigning permission to different users
to use database and monitoring of database system.
Q. 17 Who is User or End User? (3 times)
Ans. A user or end user is a person who uses computers for his specific needs. He might have a
moderate knowledge of computers, computer science and information technology. He does not need to
know in-depth knowledge of computer system.

Long Questions
Q. 1 Describe different types of Keys in Databases. (3 times)

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 5


I2 Past Papers’ Short Questions Chapter 3 Database Design Process

Chapter 3
Database Design Process
Q. 1 Define the term analysis. (3 times)
Ans. A process of studying the existing system is known as analysis. The basic purpose of analysis is
to know which activities are performed in the current system. The analysis also determines what should
take place in the new system.
Q. 2 State an Attribute with one example? (3 Times)
Ans. The characteristics of an entity are called attributes or properties. Some examples of attributes of
TEACHER are Name, Gender and Telephone No. etc. Art attribute is represented by an oval.
Q. 3 What is Relationship? Give an example (2 Times)
Ans. A logical connection between different entities is called relationship. For example, a relationship
exists between a STUDENT and TEACHER because teacher teaches student. The entities that participate
in a relationship are called participants.
Q. 4 Define Cardinality. (2 times)
Ans. The number of entity occurrences associated with each occurrence of the related entity is knows
as cardinality. It specifies how many instances of an entity related to each instance of another entity. It
means that cardinality specifies the maximum number of relationships.
Q. 5 Define Modality.
Ans. Modality describes relationship as either mandatory or optional. It specifies absolute minimum
number of relationships. The relationship is called optional if minimum number is zero. The relationship
is called mandatory if minimum number is one or more.
Q. 6 Differentiate between cardinality and modality.
Ans. The number of entity occurrences associated with each occurrence of the related entity is knows
as cardinality. Modality describes relationship as either mandatory or optional. It specifies absolute
minimum number of relationships.
Q. 7 What is E-R Diagram? (2 Times)
Ans. An ER diagram is a graphical representation of entities in a database and relationships between
them. The rectangle is commonly used to represent entities. The diamonds are normally used to
represent relationships and ovals are used to represent attributes.
Q. 8 Identify different components of ER Diagram.
Ans. The components of ER Diagram are Entity, Attribute and Relationship.
Q. 9 Explain the objectives of Database Design Process.
Ans. The major objective of database design is to map the conceptual data model to an
implementation model. A particular DBMS must be able to process this model.
Q. 10 What is a Physical Data Base Design?
Ans. Physical design is the last stage of database design process. The major objective of physical
database design is to implement the database as a set of stored records, files, indexes and other data
structures. These data structures provide adequate performance.
Q. 11 Explain the Logical Database Design.
Ans. The logical or conceptual model describes the data stored in the database. It contains the
definition of the data to be stored in database. It also contains the rules and information about the
structure and type of data. It is the complete description of data stored in database.
Q. 12 How is Data Base Integrity maintain?
Ans. Database integrity is maintained with the help of integrity constraints. The constraints are the
rules that are designed to keep data consistent and correct. They act like a check on the incoming data.
DBMS provides several mechanisms to enforce integrity of the data.
Q. 13 Distinguish between Entity and Entity Instance.
Ans. A group of entities of the same type is called entity class. All entities in an entity type share
common characteristics. For example, STUDENT entity class is a collection all students. A member of an
entity class is also known as an entity instance. For example, a student Abdullah of STUDENT entity
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 6
I2 Past Papers’ Short Questions Chapter 3 Database Design Process

type is an entity instance.


Long Questions
Q. 1 Briefly describe different Data Distribution Strategies. (3 times)
Q. 2 Explain the following terms:
a) Project Planning b) Data Analysis c) Feasibility d) Modality
Q. 3 What is ER Diagram? Give an example of ER Diagram.
Q. 4 Briefly explain the Database Design Process.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 7


I2 Past Papers’ Short Questions Chapter 4 Data Integrity & Normalization

Chapter 4
Data Integrity and Normalization
Q. 1 What is Referential Integrity? (2 times)
Ans. The referential integrity is a constraint on foreign key value. It states that if a foreign key exists in
a relation, the foreign key value must match the primary key value of some tuple in its parent relation.
Otherwise the foreign key value must be completely null.
Q. 2 Define Entity Integrity. (3 times)
Ans. The entity integrity is a constraint on primary key value. It states that any attribute of a primary
key cannot contain null value. If primary key contains null value, it is not possible to uniquely identify a
record in a relation.
Q. 3 What is Synonym? (4 times)
Ans. A synonym is a type of problem that exists in relations. A synonym is created when two different
names are used for the same information or attribute. The name of attribute must be same if it exists in
two or more entities.
Q. 4 Define Homonym.
Ans. A homonym is a type of problem that exists in relations. A homonym is created when same
name is used for two different attributes.
Q. 5 How Homonyms create problems in Database?
Ans. Suppose we have the following two relations
CUSTOMER (CustomerId, Company Name)
SUPPLIER (SupplierID, Company Name)
The above relations have homonym problem as Company Name attribute is used in both relations. It
may create confusion. A different name should be used in both relations.
Q. 6 What are the database anomalies? (2 times)
Ans. Database anomalies are the problems in relations that occur due to redundancy in the relations.
These anomalies affect the process of inserting, deleting and modifying data in the relations. Important
data may be lost if a relation with database anomalies is updated.
Q. 7 Write two types of Anomalies.
Ans. Database anomalies are the problems in relations that occur due to redundancy in the relations.
These anomalies affect the process of inserting, deleting and modifying data in the relations. Important
data may be lost if a relation with database anomalies is updated. Different types of anomalies are:
• Insertion Anomaly
• Deletion Anomaly
• Modification Anomaly
Q. 8 Explain the term Normalization? / Why is normalization used? (4 times)
Ans. The process of producing a simpler and more reliable database structure is called normalization.
It is used to create a suitable set of relations for storing data. It identifies and corrects the problems and
complexities of database design. It produces a new set of relations. The new design is as free of
processing problems as possible.
Q. 9 Describe Repeating Group.
Ans. A repeating group is a set of one or more data items that may present a variable number of times
in a tuple. Each cell in a relation should contain only one value.
Q. 10 Define Determinant?
Ans. A determinant is an attribute whose value enables us to obtain the value(s) of other related
attributes. It appears on the left side of a functional dependency. Thus, in A—>B, the determinant is A.
Q. 11 What is Partial Dependency in a Relation?
Ans. A type of dependency in which one or more non-key attributes are functionally dependent on a
part of primary key is called partial dependency.
Q. 12 What is removed when a relation is converted from 2NF to 3NF?

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 8


I2 Past Papers’ Short Questions Chapter 4 Data Integrity & Normalization

Ans. Any transitive dependencies, non-key attributes dependent on other non-key attributes, are
removed when a relation is converted from 2NF to 3NF.
Q. 13 Differentiate Partial Dependency and Transitive Dependency.
Ans. A partial dependency exists when an attribute is dependent on only a part of primary key. It is
associated with INF. Transitive dependency is a condition in which an attribute is dependent on another
attribute that is not part of primary key. It usually requires the decomposition of the table containing the
transitive dependency.

Long Questions
Q. 1 Explain Normalisation and write a note on 1st Normal Form. (2 times)
Q. 2 What is Normalisation? Explain Second Normal Form (2NF) with example.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 9


I2 Past Papers’ Short Questions Chapter 5 Introduction to Microsoft Access

Chapter 5
Introduction to Microsoft Access
Q. 1 What is MS Access?
Ans. Microsoft Access is one of the most popular and powerful DBMS. It provides various built-in
features. These features help the user to construct database and view information.
Q. 2 State the uses of MS-Access.
Ans. Microsoft Access is used to store and process a large amount of information. It is used to create
queries, forms and reports easily. It allows entering, updating and reporting information.
Q. 3 List some facilities provided by a good RDBMS.
Ans. Data security
Data integrity
Easy access
Backup and recovery etc.
Q. 4 What are reports? (2 times)
Ans. Reports are the outputs of database application. Reports are used to retrieve and present data in
a formatted way. The information on reports is arranged in different ways. A report may also contain
graphs, charts and tables etc.
Q. 5 What is an IDE? (3 times)
Ans. IDE stands for Integrated Development Environment. It is a collection of facilities provided to
the users. It is used to create databases and database applications. An IDE simplifies the tasks of
creating and using a database.
Q. 6 How do fields and records differ? (2 times)
Ans. Fields are the smaller units that make up pieces of information contained in records.
Q. 7 Give the procedure for entering a new Database in MS-Access.
Ans. A new Database in MS-Access can be created in two ways.
• Using dialog box
• Using main menu
Q. 8 How is Query written? (2 times)
Ans. The query is written in database access language such as SQL. A query retrieves data from the
database and displays it in the form of table. The user can also change data in the database by using
queries. Queries can also be used to perform calculations on fields
Q. 9 Write down the major Database Objects in MS-Access. (2 Times)
Ans. The major database objects in MS Access are Tables, Queries, Forms and Reports.
Q. 10 Define the term R.D.B.M.S. (2 times)
Ans. RDBMS stands for relational database management system. It is a collection of programs that
creates and maintains a relational database. A database in which data is stored in relations is called
relational database.
Q. 11 Write any two advantages of Form. (2 times)
• Forms are easy to use.
• Forms use graphical interface that is attractive.
Q. 12 What do you mean by Query? (3 times)
Ans. A query is a statement that extracts specific information from database. Queries are used to
retrieve the required data from database. Data is retrieved according to the criteria given by the user. It
is a more flexible way of selecting, filtering and sorting records.
Q. 13 List some advantages of (Integrated Development Environment) IDE. (2 times)
• It is easy to use.
• It simplifies the creation of database applications.
• It does not require a detailed knowledge of databases.
• It provides predefined facilities to search, sort, retrieve and process data in databases.
Q. 14 List any five buttons available on Access database window.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 10
I2 Past Papers’ Short Questions Chapter 5 Introduction to Microsoft Access
Ans. Different buttons available on Access database window are Tables, Queries, Forms, Reports,
Pages, Macros and Modules.

Long Questions
• What is Database Object? Discuss database objects used to store and retrieve data. (2 times)
• Define RDBMS. Which facilities are provided by RDBMS?
• Briefly describe the advantages of using MS ACCESS.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 11


I2 Past Papers’ Short Questions Chapter 6 Table & Query

Chapter 6
Table and Query
Q. 1 What is Filter?
Ans. A filter is used to extract the records that match a set of criteria. Filters are basically
queries but they only appear to open tables or forms.
Q. 2 List out different types of queries?
Ans. Different types of queries are Select Queries, Action Queries, Crosstable Queries,
Parametric Queries and SQL Queries.
Q. 3 What is Text Data Type?
Ans. Text data type is used to store alphabetic, numbers and special characters. It can store up
to 255 characters. The default length of Text data is 50 characters.
Q. 4 What is Select Query?
Ans. A select query is used to extract data from tables based on specified values. It gathers
information and presents it in usable form. It may retrieve data from one or more tables. It
displays the results in datasheet where the records can be updated.
Q. 5 Define Freezing Columns?
Ans. The user can freeze the columns on an Access table. It helps the user to view certain
columns easily I he datasheet has many columns and the required columns are not visible.
Q. 6 List different types of Action Queries. (2 times)
Ans. Different types of action queries include Delete Query, Update Query, Append Query
and Make Table Query.
Q. 7 List out different data types available in MS. Access. (2 Times)
Ans. MS Access provides the data types of Text, Memo, Number, Date/Time, Currency,
AutoNumber and Yes/No.
Q. 8 Describe Field Property.
Ans. Field properties are used to define how data will be entered, stored and displayed in MS
Access. The properties of each field can be set in design view.
Q. 9 How the degree of Relation can be defined? (2 times)
Ans. The number of fields in a relation is called degree of a relation. The degree of a table is usually
not changed once the table has been created. A table with five fields has a degree of 5.
Q. 10 Name three methods for creating tables in MS ACCESS.
Ans. Three methods for creating tables in Access include Create table in Design view, Create
Table by using wizard and Create table by entering data.
Q. 11 What is Database Wizard?
Ans. A database wizard is a set of steps that guides the user to create a database easily. It
includes choosing a database template, selecting fields, making customizations, adding pictures
and the database.
Q. 12 Name two table views available in MS – ACCESS. (3 times)
Ans. Table view is a way of looking at the table. MS Access provides two table views that are
Design view and Datasheet view.
Q. 13 Differentiate between a Table and Database.
Ans. The database is the main structure that holds one or more tables. A table is an object in
the database that is used to store data about a particular entity.
Q. 14 Define Parameter Queries?
Ans. A parametric query displays a dialog box when it is executed. It gets some information
from the user as parameter. These queries are used as basis for creating forms and reports.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 12
I2 Past Papers’ Short Questions Chapter 6 Table & Query
Q. 15 How will you designate a Primary Key field?
Ans. The following procedure is used to designate a primary key field.
▪ Open the table in design view.
▪ Select the field for primary key.
▪ Click Primary Key button on Table Design toolbar. OR select Edit>Primary Key. The
field is marked as Primary key.
Q. 16 List out some advantages of referential integrity?
Ans. The most important advantages of referential integrity are that if the record does not
exist in master table, it cannot be stored in the child table. A record cannot be deleted from
master table if a related record exists in the child table.
Q. 17 Differentiate between AutoNumber and other data types.
Ans. The use of AutoNumber is different from other data types. If a field has AutoNumber
data type, the value in the field is automatically entered by DBMS starting from 1 and so on.
The value is incremented by 1 in each record.
Q. 18 What is the use of input mask?
Ans. An input mask controls the value of a record and sets it in a specific format. It is similar
to Format property but it displays the format on datasheet before the data is entered.

Long Questions
• What is Query? Discuss its uses and advantages.
• Explain the different data types available in MS-ACCESS. (2 times)
• What is Query? Explain the various types of queries. (2 times)
• Discuss different characteristics of a Table. Also define degree and cardinality of a
relation. (2 times)
• What is filter? Discuss different types of filters used in MS-ACESS.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 13


I2 Past Papers’ Short Questions Chapter 7 Microsoft Access Forms & Reports

Chapter 7
Microsoft Access Forms and Reports
Q. 1 Enlist two uses of form.
Ans. Form is used to manipulate databases easily. It can be used to add data in the database,
modify data in the database, delete data from the database, retrieve and view data from the
database and search the required data from the database.
Q. 2 What is List Box and Combo Box?
Ans. List box is used to display a list of item in forms. The user can select the desired item
from the available items. The user can select one or multiple items. Combo box is used to
display a list of item in forms. It consists of a textbox and a dropdown list. The user can select
the desired item from the combo box.
Q. 3 List out the different methods of creating sub-forms.
Ans. • Creating a form and sub-form at once
• Creating sub-form using Sub-form wizard
• Creating sub-form using drag-and-drop method
Q. 4 List different types of forms in MS-Access.
Ans.
• Columnar Form
• Tabular Form
• Datasheet Form
• Justified Form
Q. 5 Differentiate between check box and radio button.
Ans. Checkbox is used when the user can select one or multiple options at the same time. The
user can select any or all values from a group of check boxes. Radio button is used when the
user can select only one option from a group of radio buttons.
Q. 6 What is Conditional Formatting?
Ans. The conditional formatting is a special type of formatting. This formatting depends on
the control's value and can be added to text boxes, lists, and combo boxes. The conditional
formatting can be set up to three conditional formats.
Q. 7 What is a List Box? (2 times)
Ans. List box is used to display a list of item in forms. The user can select the desired item
from the available items. The user can select one or multiple items. List box occupies a specified
space on the form. A scrollbar appear in the list box if the numbers of items are more than the
available space.
Q. 8 Write the use of Tabular Form.
Ans. Tabular form is used to display many records at one time. It displays records as a table. Each row
in this form displays one record of the table.
Q. 9 What is Linking in MS ACCESS?
Ans. The process of linking in MS Access creates a link to an object in another database. The
table is not copied to the current database.
Q. 10 Give one difference between Form and Report. (2 times)
Ans. The main difference between form and report is that form is used to input data in
database. The report is used to display data from tables.
Q. 11 What is the purpose of radio button in MS-ACCESS? (2 Times)

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 14


I2 Past Papers’ Short Questions Chapter 7 Microsoft Access Forms & Reports
Ans. Radio button is also known as option button. It is used to display yes/no, true/false or
on/off option to the user. It is used when the user can select only one option from a group of
radio buttons. The user can select a radio button by clicking on it.
Q. 12 What is the difference between Columnar Form and Tabular Form?
Ans. Columnar form is used to display one record at a time. It displays textboxes and labels.
The textboxes represents the fields of the table or query. The labels represent the names of the
fields. Tabular form is used to display many records at one time. It displays records as a table.
Each row in this form displays one record of the table.
Q. 13 Describe sub-form. (2 times)
Ans. A sub-form is a form that is placed in a parent form. The parent form is called the main
form. Sub-forms are particularly useful to display data from tables and queries with one-
to¬many relationships.
Q. 14 Differentiate between Check Box and List Box.
Ans. Checkbox is used to display yes/no, true/false or on/off option. It is used when the user
can select one or multiple options at the same time. Whereas List box is used to display a list of
item in forms. The user can select the desired item from the available items. The user can select one or
multiple items.

Long Questions
• Define Report. Discuss its two types in detail.
• Discuss different options for editing Forms in MS-ACCESS

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 15


I2 Past Papers’ Short Questions Chapter 9 Elements of C

Chapter 8
Getting Started With C
Q. 1 What is the use of “include” Preprocessor? (2 times)
Ans. The "include" preprocessor directive enables a program to access a library. Each library
contains different header files. The include preprocessor directive is used to include header files
in the program.
Q. 2 Who is Programmer?
Ans. A person who develops a computer program is called programmer. The programmer
develops programs to instruct the computer how to process data to convert into information.
Programmer uses programming languages or tools to write programs.
Q. 3 List different types of programming languages./ Write two main categories of
Programming Languages. (2 times)
Ans. The two main categories of computer programming languages are low-level languages
and high-level languages.
Q. 4 What is a compiler?
Ans. A compiler is a program that converts the instruction of a high level language into
machine language as a whole. The compiler converts the source program into machine code.
The machine code program is known as object program.
Q. 5 What is ANSI C?
Ans. The American National Standard Institute (ANSI) developed a standard version of the
language. The standard version is known as ANSI C.
Q. 6 Compare source code and object code?
Ans. Source code is easy to understand and modify. Object code is difficult to understand and
modify. Source code contains fewer statements than object code.
Q. 7 What do you mean by the syntax error? (3 times)
Ans. Syntax error is a type of error that occurs when an invalid statement is written in
program. Syntax errors are detected by compiler. A program containing syntax errors cannot be
compiled successfully. Typing 'forr' instead of 'for' is an example of syntax error.
Q. 8 Differentiate between compiler and interpreter.
Ans. The main difference between compiler and interpreter is that compiler converts a
program into machine code as a whole and interpreter converts a program into machine code
statement by statement
Q. 9 Describe the term Machine Independence. (3 times)
Ans. Machine independence means that programs written in one language can be executed
on different types of computers. For example, a program written in C can be executed on Intel
processors and Motorola processors.
Q. 10 How does a compiler work? (3 times)
Ans. The compiler checks each statement in the source program and generates machine
instructions. Compiler also checks syntax errors in program. A source program containing an
error cannot be compiled.
Q. 11 What is main function used in C programs?
Ans. The main() function is the place where the execution of a C program starts. When the
program is executed, the control enters main() function and starts executing its statements. Each
program must contain main() function.
Q. 12 List some advantages of C-Language.
Ans. Convenient Language
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 16
I2 Past Papers’ Short Questions Chapter 9 Elements of C
Well-Structured Language
Machine Independence
Modularity
Q. 13 Why is Logical Error the most difficult error?
Ans. It cannot be detected by the compiler.
It does not crash the program. That is why it is difficult to detect.
The user needs to review the whole program to find out logical error.
Q. 14 Write about unstructured programming languages.
Ans. In unstructured programming languages, the entire logic of the program is implemented
in a single module or function. The programs written in these languages are error prone,
difficult to understand, modify and debug.
Q. 15 What is meant by Language Processor?
Ans. Language processor or translator is software that converts the programs of high-level
languages into machine language. Every computer language has its own translators. Different
types of translators include compiler, interpreter and assembler.
Q. 16 What is the purpose of Linking in C-Program? (2 times)
Ans. The process of linking library files with object code is known as linking. The
programmer may refer to many files in a C program. The library files must be linked with the
object file before execution the program.
Q. 17 Describe the Pre-Processor Directive. (4objec times)
Ans. The preprocessor directives are commands that give instructions to C preprocessor. The
preprocessor directives are processed by a program called preprocessor. Preprocessor
directives start with hash symbol # and the keyword include or define. These directives are
written at the start of program.
Q. 18 What is Linker?
Ans. The purpose of linker in C language is to combine the object program with additional
library files. Linker is part of compiler. It combines object program and library files and saves
final machine language program as executable file. The extension of executable file is .exe.
Q. 19 Write two advantages of High Level Language.
Ans. High-level languages are easy to learn than machine level languages. The program
written in high level languages are shorter than machine level languages. High level languages
provide machine independence.
Q. 20 Define Source Code.
Ans. A program written in a high level language is called source code. It is also called source
program. The source code cannot be executed by computer directly. It is converted into
machine code and then executed.
Q. 21 Define Object Code.
Ans. A program in machine language is called object code. It is also called object program.
Computer understands object code directly.
Q. 22 What are Logical Errors? Give example.
Ans. A type of error that occurs due to poor logic of the programmer is known as logical
error. A statement with logical error may produce unexpected and wrong results in the
program. Typing a wrong formula to calculate the result is an example of logic error.
Q. 23 Define Low Level Language.
Ans. A language that is close to hardware and far from human language is called low level
language.
Q. 24 List any four commonly used high level languages. (2 times)
Ans. Common high-level languages are C/C++, Java, Pascal, FORTRAN, BASIC, COBOL.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 17
I2 Past Papers’ Short Questions Chapter 9 Elements of C
Q. 25 Why the source code cannot be executed directly?
Ans. A program written in a high level language is called source code. It is also called source
program. The source code cannot be executed by computer directly. It is converted into
machine code and then executed.
Q. 26 Differentiate between Preprocessor directives and header file.
Ans. The preprocessor directives are commands that give instructions to C preprocessor.
They can be used to include files in programs or define constants. The header files are
collection of standard library functions to perform different tasks. These files can be included
in programs to perform specific functions.
Q. 27 Why does machine language program execute faster?
Ans. A program written in machine language can be executed very fast by computer. The
computer does not need any translator to understand this language.
Q. 28 Write use of Turbo C++.
Ans. The compiler used for C language is Turbo C++. It is the implementation of Borland
International for C language. It is used to create, edit and save programs. It also provides a
powerful debugger. The debugger helps users in detecting and removing errors in programs.
Q. 29 Define Computer Program.
Ans. A well-defined set of instructions given to the computer is called a computer program. A
computer program is written in a programming language.
Q. 30 What is Assembly Language? (3 times)
Ans. Assembly language is a low-level language. It is one step higher than machine language.
In assembly language, machine instructions are replaced with English-like words known as
mnemonics.
Q. 31 How .exe file is created?
Ans. The executable (.exe) file of the program is created when the object code is linked with
library files. This file is saved on the disk with an extension .exe.
Q. 32 What is the use of "include" preprocessor./Why #include directive is used in C language?
Ans. The "include" preprocessor directive enables a program to access a library. Each library
contains different header files. The include preprocessor directive is used to include header files
in the program.
Q. 33 Define Delimiters. /What do you mean by delimiters?
Ans. The statements of the program are written in curly braces. The curly brace ‘{’ is called
opening brace and ‘}’ is called closing brace. The braces are also known as delimiters. These
statements are collectively known as the body of a program.
Q. 34 What is the use of "define" Directive/preprocessor. Also give example.
Ans. The define directive is used to define a constant. It starts with the symbol #. It is not
terminated with semicolon. It can be used anywhere in the program. #define directive is used to
define constant. For example #define PI 3.142857
Q. 35 Write the shortcut key for saving and compiling a C program.
Ans. The shortcut key for saving a program is F2. The shortcut key to compile C program is
ALT+F9.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 18


I2 Past Papers’ Short Questions Chapter 9 Elements of C

Long Questions
Q. 1 Define High Level Language. Write down the characteristics of C-Language.
Q. 2 How would you define High Level Language? Write common characteristics of all High
Level Programming Languages.
Q. 3 Write a detailed note on basic structure of a C Program.
Q. 4 What is Preprocessor directive? Explain different types of preprocessor directives with
their syntax.
Q. 5 How would you create, edit, compile, link and execute a C-Program? Discuss. /Explain
any four steps for writing and executing C-Language Program. (5 times)
Q. 6 What is Program? Describe different types of errors while occurring in writing C-
Program. (6 times)

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 19


I2 Past Papers’ Short Questions Chapter 9 Elements of C

Chapter 9
Elements of C
Q. 1 What is Operator Precedence?
Ans. The order in which different types of operators in an expression are evaluated is known
as operator precedence. It is also known as hierarchy of operators. Each operator has its own
precedence level.
Q. 2 Define Type Casting?
Ans. The process of converting the data type of a value during execution is known as type
casting. The types casting are Implicit type casting and Explicit type casting.
Q. 3 What is Increment Operator?
Ans. The increment operator is used to increase the value of a variable by 1. It is denoted by
the Symbol ++. It is a unary operator and works with single variable.
Q. 4 What is a variable? (2 times)
Ans. A variable is a named memory location or memory cell. It is used to store program's
input data and its computational results during execution. The value of variable may change
during the execution of the program. However, the name of variable cannot be changed.
Q. 5 What is variable initialization? (4 times)
Ans. The process of assigning a value to a variable at the time of declaration is known as
variable initialization. The equal sign = is used to initialize a variable. Variable name is written
on left side and the value is written on the right side of equal sign.
Q. 6 What is Garbage value?
Ans. In a C program, when the variable is declared, compiler set aside some memory space
for it. This allocated memory space may contains meaningless data. That meaningless data is
called Garbage value.
Q. 7 What is Assignment Operator? (2 times)
Ans. A statement that assigns a value to a variable is known as assignment statement. The
assignment operator = is used in assignment statement to assign a value or computational result
to a variable.
Q. 8 What is the use of OR operator? (2 times)
Ans. The symbol used for OR operator is (|| ). It is used to evaluate two conditions. It
produces true if either condition is true. It produces false result if both conditions are false
Q. 9 What are comments? (3 times)
Ans. Comments are the lines of program that are not executed. The compiler ignores
comments and does not include them in the executable program. That is why the comments do
not affect the size of executable program.
Q. 10 Why are comments used in C program?
Ans. Comments are used to increase the readability of the program. Comments are notes
about different lines of code that explain the purpose of the code. The user can insert
information notes in the code. It helps in debugging and modifying the program later.
Q. 11 How we add comment on single line? (2 times)
Ans. Comments on single line are added by using double slash "//". Anything written on the
right side of double slash is considered as comments and is ignored during execution
Q. 12 Differentiate between increment and decrement operator.
Ans. The increment operator is used to increase the value of a variable by 1. It is denoted by
the Symbol ++. The decrement operator is used to decrement the value of a variable by 1. It is
denoted by the symbol --.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 20
I2 Past Papers’ Short Questions Chapter 9 Elements of C
Q. 13 Rewrite the following expression without using the operator: ++
another ++
Ans. another = another +1;
Q. 14 Define the compound assignment statement? (2 times)
Ans. An assignment statement that assigns a value to many variables is known as compound
assignment statement. The assignment operator = is used in this statement.
Q. 15 What is Arithmetic Expression? (2 times)
Ans. A type of expression in which only arithmetic operators are used is called arithmetic
expression. An arithmetic expression may contain integers and floating point numbers.
Q. 16 Define Keywords and give an example. (4 times)
Ans. Keyword is a word in C++ language that has a predefined meaning and purpose. The
meaning and purpose of a keyword is defined by the developer of the language. It cannot be
changed or redefined by the user. Examples include if, while, int, and cont.
Q. 17 Define Variable Declaration. (2 times)
Ans. The process of specifying the variable name and its type is called variable declaration. A
variable must always be declared before it can-be used in a program. The compiler gives an
error if an undeclared variable is used in a program.
Q. 18 Write Z = area √𝒂𝒓𝒆𝒂 in C-Language.
Ans. Z = area * sqrt(area);
Q. 19 Define Standard Identifier with example.
Ans. A type of identifier that has special meaning in C is known as standard identifier. C
cannot use a standard identifier for its original purpose if it is redefined. printf and scanf are
examples of standard identifiers.
Q. 20 How does Overflow Occur? Give example.
Ans. The arithmetic overflow occurs due to the manipulation of two very large numbers. The
result may be too large to be represented when two very large numbers are manipulated. A
garbage value may appear in this situation. For example, an integer variable can store values
from -32768 to 32767. An overflow will occur if the assigned value is more than 32767.
Q. 21 Define the term constant.
Ans. A constant is a quantity that cannot be changed during program execution.
Q. 22 What is the use of Decrement Operator?
Ans. The decrement operator is used to decrement the value of a variable by 1. It is denoted
by the symbol -. It is a unary operator and works with single variable.
Q. 23 What are the uses of Operators?
Ans. Operators are the symbols that are used to perform certain operations on data. C
provides a variety of operators. These include arithmetic operators, relational operators, logical
operators, bitwise operators etc.
Q. 24 Write the mathematical expression in C expression. Ke = 1/2mv2
Ans. Ke = 1 / 2 * m * v * v;
Q. 25 Why is C knows as strongly typed language?
Ans. C is a strongly typed language. It means that a variable must always be declared before it can be
used in a program. The compiler gives an error if an undeclared variable is used in a program.
Q. 26 Write down two rules for declaring naming variable in C.
Ans. Any two from the following.
• The first character of variable must be a letter or underscore.
• Blank spaces are not allowed in variable names.
• Variable may include letters, numbers and underscore ( _ ).

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 21


I2 Past Papers’ Short Questions Chapter 9 Elements of C
• Reserved word cannot be used as variable name.
Q. 27 Name data types used to store real data.
Ans. The data types used for storing real/floating point data are float, double and long
double.
Q. 28 State Character Constant.
Ans. Any character written in single quotation mark is called character constant. All
alphabetic characters, digits and special symbols can be used as character constants. Some
examples of character constants are 'A',9','=' and 1' etc.
Q. 29 Write a statement to declare an Integer variable initialized to 10
Ans. int x = 10;
Q. 30 What is Data Type?
Ans. Data type defines a set of values and a set of operations on these values. The computer
manipulates various types of data. The data and its type are defined before designing the actual
program that is used to process the data. The type of each data value is identified at the
beginning of program design.
Q. 31 How many bytes are occupied by Long and Double Data types?
Ans. Long takes 4 bytes in memory whereas Double takes 8 bytes in memory.
Q. 32 Distinguish between a constant and a variable.
Ans. The value stored in a variable can be changed during the execution of the program. The
values stored in constants cannot change.
Q. 33 What is Character constant and Numeric constant?
Ans. Any character written in single quotation mark is called character constant. All
alphabetic characters, digits and special symbols can be used as character constants. Some
examples of character constants are 'A',9','=' and 1' etc. Numeric constant consist of numbers. It
can be further divides into two types. i.e. Integer constant and Floating point constant.
Q. 34 What is an identifier? Give some examples of identifier.
Ans. The identifiers are the names used to represent variable, constants, types, functions and
labels in the program. An identifier in C may consist of any number of characters. But the first
31 characters are significant to C compiler. Some examples of identifiers are Student_Age,
Item20, Sum etc.
Q. 35 Write the following Arithmetic Expression in ‘C’.
𝒂 ( 𝒃 ÷ 𝟑 × 𝟒 − 𝟔 + 𝟕)
Ans. a * (b / 3 * 4 – 6 + 7)
Q. 36 Enlist symbols of Relational Operators.
Ans. The symbols used for Relational Operators are as follows:
<, <=, >, >=, ==, !=

Long Questions
• What is constant? Explain different types of constants.
• Define variable? Explain the rules of creating/naming variable.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 22


I2 Past Papers’ Short Questions Chapter 10 Input and Output

Chapter 10
Input and Output
Q. 1 Define the term field width specifier. (2 times)
Ans. The number of columns used to display a value on screen is called field-width. A field
width specifier describes the number of columns that should be used to print a value. It
determines how the value will be displayed on the screen.
Q. 2 What are escape sequence characters? (3 times)
Ans. Escape sequences are special characters used in format string to modify the format of
output. These characters are not displayed in the output. These characters always begin with
backslash "\". The backslash is known as escape character.
Q. 3 What is “scanf” function? Write the syntax of scan function.
Ans. The scanf function is used to get input from the user. The input is stored in a variable.
Syntax of scanf function is as follows:
scanf(control string, &variablel, &variable2, &variable3 ...);
Q. 4 Describe the use of ampersand (&) in scarf function?/Why is the ampersand (&) used
in Scanf function?
Ans. The ampersand (&) refers to the memory location of the variable in which the input is
stored. It is placed before variable name. It is also called address operator.
Q. 5 List some important functions for output.
• scanf()
• gets()
• getch( )
• getche()
Q. 6 Differentiate between Gets and Puts functions. (2 times)
Ans. The Gets function is used to input string values from the user. The input stored in a
string variable. The Puts function is used to display string values on the screen. It can display
string constant or string variable.
Q. 7 What is the purpose of “\n” Escape sequence? (2 times)
Ans. This escape sequence is used to insert new line in output.
Q. 8 What is the use of “getche” function? (2 Times)
Ans. The getche( ) function is used to input single character from the user. It is an
abbreviation of "get character". When this function is executed, the character entered by the
user is displayed on the screen.
Q. 9 What is the use of “getch” function?
Ans. The getch( ) function is used to input single character from user. It is an abbreviation of
"get character". When it is executed, the character entered by user is not displayed on screen.
Q. 10 What is the purpose of %d format specifers in C-Language?
Ans. The format specifier %d is used for signed decimal integer value.
Q. 11 Explain standard output?
Ans. The process of getting something from computer is known as output. The output is
mostly displayed on monitor. The term standard output refers to the output displayed on
monitor. The result of a program is the output of that program.
Q. 12 What is Control String in printf function?
Ans. The control string is given in double quotes. It may consist of Text, Format specifiers, ape
sequences and Parameters.
Q. 13 List out different format specifier for Integer values.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 23
I2 Past Papers’ Short Questions Chapter 10 Input and Output

Ans. Different format specifiers for integer values are %d, %i, %o, %u, and %x.
Q. 14 Name any four escape sequence characters provided by C Language. (3 times)
Ans. Different escape sequences used in C language are \a, \b, \f, \n, \r and \t.
Q. 15 Discuss the role of “\b”.
Ans. It is an escape sequence character which is sued in printf function. It causes the cursor to
move one space left.
Q. 16 Differentiate between getch( ) and getche( ). (3 times)
Ans. The getch ( ) and getche () function is used to input single character from the user. When
getch() function is executed, the character entered by user is not displayed on screen. When
getche( ) function is executed, the character entered by user is displayed on screen.
Q. 17 Describe clrscr( ) function. (3 times)
Ans. The clrscr function is used to clear the screen. It is an abbreviation of "clear screen".
When this function is executed, the screen is cleared and the cursor blinks on the top-left corner.
This function is available in the header file conio.h.
Q. 18 Discuss the purpose of %c format specifier.
Ans. The format specifier %c is used for single character values.
Q. 19 List any two important function for input in C.
Ans. scanf( ), getch( ), getche( ), get( ).
Q. 20 What do we mean by Standard Input?
Ans. The process of giving something to computer is known as input. The input is mostly
entered by keyboard. The term standard input refers to the input via keyboard.
Q. 21 What is use of format specifiers in C language? / What are Format Specifier? Also give
example.
Format specifier is used to specify the format according to which values will be read and
displayed. It determines the data type of variable, field width and format of the value.
For example %d, %f, %c etc.
Q. 22 Write a C statement to declare integer variable x and assign any value to x.
Ans. int x;
x = 20;

Determining the Output and Finding Errors


Q. 1 Find error.
int n;
printf(“Enter any number”);
scanf(%c”,&p)
printf(“Number = “,n)
Ans. In third line in scanf statement the variable p is not declared and also ; is missing at the
end of this statement. In last line again ; is missing at the end of this statement and in printf
statement %d is missing.
Q. 2 Find the errors in the following code.
{
int n = 6;
n ++,
Print f(“%d,n);
}
Ans. In second line ; is missing at the end of statement.
In third line P is capital in printf and also there is the space between print and f.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 24
I2 Past Papers’ Short Questions Chapter 10 Input and Output

In printf statement double quotes are missing after format specifier.


Q. 3 Trace the output.
int number = 6;
int x = 0;
x = --number;
printf(%d”,x);
Ans. 5
Q. 4 Trace out errors in the following code.
float r;
Clrscr( )
print f(“enter radius”);
Scanf(“%f”;r);
Ans. In second line the C is capital in clrscr( ) function and also ; is missing at the end of
statement.
In third line there is the space between print and f.
In fourth line S is capital in scanf function and also there is ; after double quotes instead of , .
Q. 5 Determine the output of the following code.
int i = 515;
printf(“i = %5d”,i);
printf(“i = %d”,i);
Ans. i = □□515i = 515
Q. 6 Predict the output of the following code.
{
printf(“ * \n * * \n * * * \n * * * *\n”);
}
Ans. *
**
***
****
Q. 7 Trace output of the following code.
int i = -786;
printf(“%6d”,i);
Ans. □□-786
Q. 8 Trace Error in the following code.
#include(stdio.h);
void main ( )
{
Print f(“OK);
}
Ans. In the first line the header file written in parenthesis() instead of angle brackets(<>) and
at the line end there is ; which should not be there. In fourth line printf is written with capital P
and there is also space between print and f. Quotation mark should be closed in printf
statement. (i.e. printf(“OK”);)
Q. 9 Trace error in the following code.
#include<stdio.h>
Void main( )
{

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 25


I2 Past Papers’ Short Questions Chapter 10 Input and Output

int i;
Scanf(“%d”,i);
Printf(“%d,i);
}
Ans. In second line void should be written with small v. In fifth line scanf should be written
with small s and variable i should be written with Address operator (i.e. scanf(“%d”,&i). In
sixth line printf should be written with small p and quotation mark should be closed. (i.e.
printf(“%d”,i);)
Q. 10 Determine the output of the following code. (2 times)
int a, b, c;
a = 3;
b = 3;
c = a % b;
pirntf(“%d”,c);
Ans. 0
Q. 11 What is the output of the following code.
int b = 9;
b = b/2;
printf(“%d”,b);
Ans. 4
Q. 12 Find the output.
int x = 20;
int y = 30;
int temp;
temp = x;
x = y;
y = temp;
printf(“ x = %d, y = %d”, x,y);
Ans. x = 30 , y = 20
Q. 13 What is the output of the following piece of code?
#include<stido.h>
#include<conio.h>
void main()
float f = 3.14159;
printf(“f=%3.2f”,f);
getch();
Ans. f=3.14
Q. 14 Show the output.
#include<stido.h>
#include<conio.h>
void main()
{
inta,b,c;
a=5; b = 10; c = a+b;
printf(“The sum of a+b=%d”,c);
getch();
}

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 26


I2 Past Papers’ Short Questions Chapter 10 Input and Output

Ans. The sum of a+b=15


Q. 15 Q.15 Find out errors from following code:
char c
clrscr();
printf(“Enter character”);
c = getch();
printf(“\n”,c);
Ans. The ; is missing in first statement. In last statement the format specifier %c is missing in
printf statement.
Q. 16 Find out the output of the following code.
Char w1, w2, w3;
w1 = ‘A’;
w2 = ‘B’;
w3 = ‘C’;
Printf(“%c %c %c”,w1,w2,w3);
Ans. ABC
Q. 17 Trace out the errors from the following.
int x
x + 4 = x;
printf(“%d”,x);
Ans. In first line ; is missing at the end. In second line expression is incorrectly written. It
should be like this.
x = x+4;
Q. 18 What will be the following code display.
printf(“Book \n reading”);
printf(“ is a \t good \n habit”);
Ans. Book
reading is a good
habit
Q. 19 What is the output of the following?
#include<stdio.h>
#include<conio.h>
void main( )
{
char ch1 = ‘A’, ch2 = ‘B’, ch3 = ‘C’;
printf(“ch2 \n %c \n ch1”, ch3);
getch();
}
Ans. ch2
C
ch1
Q. 20 Determine the output of following.
void main( )
{
int a,b,c;
a = 10;
a = 20;

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 27


I2 Past Papers’ Short Questions Chapter 10 Input and Output

a = 30;
b = 40;
b = 50;
c = a + b;
printf(“The sum is %d ”,c);
getch();
}
Ans. The sum is 80
Q. 21 Find the error from the code
void main( );
{
int x = 4;
x + 4 = x;
printf(“The value of x is %f”,x);
getch();
}
Ans. In first line ; should not be placed after the main function. In line number 4 the
expression is incorrect it should be x = x + 4.
Q. 22 Find errors in the following.
main [ ]
{
float n;
scanf(“%f”,n);
}
Ans. In first line square brackets [ ] cannot be used, there should be parenthesis ( ).
main( )
Q. 23 Predict the errors in the following code.
#include<stdio.h>:
void main( )
{ int a = 10;
Printf(“%d”);
}
Ans. In the first line semicolon(;) after include<stdio.h> is invalid. In the Printf statement must
be written in lower case and in printf statement %d is must replace by (“%d”,a).
Q. 24 Predict the errors in the following code.
#include<stdio.h>
Main( );
{
Printf(“%d”,a,b);
}
Ans. Main must be written in lower case and there should be no semicolon after main
function. Printf statement must be written in lower case and in printf statement there should be
two format specifier for two variables a and b. Variable a and b must declared.
Q. 25 Trace out the errors in following code.
#include<stdio.h>
#include<conio.h>
void main( );

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 28


I2 Past Papers’ Short Questions Chapter 10 Input and Output

{
printf(“%s”,Pak);
getch();
}
Ans. In third line ; should not be placed after void main( )function. On 5 th line in printf
statement “Pak” variable should be initialized before it is used in printf statement.
Q. 26 Trace the error in the following C code.
#include<stdio.h>
Void main( )
{
Prin(“C Language is interesting”);
}
Ans. Void must be written in lower case like void. Secondly Prin must be written with lower
letter and it should be printf instead of Prin.
Q. 27 Trace the output.
int i = 20;
printf(“%6d”,i);
Ans. □□□□20
Q. 28 What will be the output of the following.
float t = 3.8961
printf(“value of t = %6.2f”,t);
Ans. value of t = □□3.90
Q. 29 Q.27 Determine the output:
printf(“ 777\n”);
printf(“ 77 “);
Ans. □777 77
Q. 30 Determine the output:
int num = 10;
num * = 5
printf(“%d”,num);
Ans. 50
Q. 31 Find the Errors:
void main ( );
{
int x = 5;
printf(“%d”,x);
}
Ans. There should be no ; at the end of first line.
Q. 32 Fine erros in the following code:
void main( )
{ int x = 5
Int y;
y = x + 3;
printf(* %d ,y);}
Ans. 1- The semicolon(;) is missing at the end of second line.
2- In fifth line %d must be written in double quotes( “ “).
Q. 33 Determine the output of the following code segment.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 29


I2 Past Papers’ Short Questions Chapter 10 Input and Output

float f = 6.3159;
printf(“ f = %3.2f “, f);
Ans. 6.32
Q. 34 Write a single C statement to print the following output:
Hello to
The World of
C Programming
Ans. printf(“Hello to\nThe World of\nC Programming”);
Q. 35 What will be the output of the following code:
int m = 7;
int y = 3;
printf(“%d”,m%y);
Ans. 1
Q. 36 Find output of following code:
int K = 8;
int m = 7;
int z = K < m ? K++ : m++;
printf(“%d”, z);
Ans. 7
Q. 37 Find the errors:
int a = 1, b = 1;
a + == b;
Ans. In line no. 2 == should be replace by =.
Q. 38 Find output:
printf(“Welcome\n”);
printf(“Thanks”);
Ans. Welcome
Thanks
Q. 39 Determine the output of the following code:
int ch = 97;
printf(“%c”, ch);
printf(“%d”, ++ch);
Ans. a98
Q. 40 Find and reٍmove errors in the following code:
char c,
getch(c);
Ans. In the end of first line ; is missing. It should be like this:
char c;
Ans. In the second line the variable name c is written in the parenthesis it should not be there.
It should be like this:
c = getch( );
Q. 41 Trace output:
void main( )
{ int a = 5;
a * = 2;
printf(“%d”,a); }
Ans. 10

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 30


I2 Past Papers’ Short Questions Chapter 10 Input and Output

Q. 42 Trace errors in the following:


Char ch = a;
Scanf(“%d, ch);
Ans. In the first line Char is written with capital C, it should be small c, and a should be
written and single quote like ‘a’. In second line s should be small of scanf. %d should be written
in double quotes (“%d”). There should be & operator before ch. The corrected code should be
like this.
char ch = ‘a’;
scanf(“%d”, &ch);
Q. 43 Write the output of the following code:
float p = 79.23;
printf(“%10.1f”, p);
Ans. □□□□□□79.2

Long Questions
• What is format specifier? Discuss different format specifier in C-Language.
• Explain Scanf function with suitable examples.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 31


I2 Past Paper Short Questions Chapter 11 Decision Constructs

Chapter 11
Decision Constructs
Q. 1 Define Control Structure. (4 times)
Ans. A statement used to control the flow of execution in a program or function is called
control structure. The control structures in C are used to combine individual instruction into a
single logical unit. The logical unit has one entry point and one exit point.
Q. 2 What is sequence structure? (2 times)
Ans. In sequence structure, the instructions are executed in the same order in which they are
specified in the program. The control flows from one statement to other in a logical sequence.
Q. 3 What “if else” statement?
Ans. if else statement is another type of if statement. It executes one block of statement(s)
when the condition is true and the other when it is false. In any situation, one block is executed
and the other is skipped.
Q. 4 Write the syntax of “if…else” statement. (3 times)
Ans. The syntax of if else statement is as follows:
if (condition)
statement;
else
statement;
Q. 5 What do you mean by Selection structure? (3 times)
Ans. A selection structure selects a statement or set of statements to execute on the basis of a
condition. There are two types of selection structures. These are if, if-else and switch.
Q. 6 What is switch statement?
Ans. The switch statement is a good alternative of nested if-else. It can be used easily when
there are many choices available and only one should be executed. The switch construct is
useful in the cases where selection is based on the value.
Q. 7 Which data type can be used in the expression in Switch Statement?
Ans. The data types that can be used in the expression in switch statement are int and char.
Q. 8 Define If…else…if statement. Construct the general form of if….else….if statement.
(3 times)
Ans. if-else-if statement can be used to choose one block of statements from many blocks of
statements. It is used when there are many options and only one block of statements should be
executed on the basis of a condition. Its syntax is as follows:
if(condition)
{
Block 1;
}
else if(condition)
{
Block 2;
}
else if(condition)
{
Block 3:
}
.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 32
I2 Past Paper Short Questions Chapter 11 Decision Constructs
.
.
else
{
Block N;
}
Q. 9 What happen if break is missed in case block?
Ans. If break is not used, all case blocks coming after matching case will also be executed.
Q. 10 What is the alternative of if-else statement in C?
Ans. Conditional operator is an alternative of if-else statement in C. It is a decision-making
structure. It is also called ternary operator as it uses three operands.
Q. 11 What is the use of Break in Case Block? Why Break statement used in a switch
structure (5 times)
Ans. The break statement in each case label is used to exit from switch body. If break is not
used, all case blocks coming after matching case will also be executed.
Q. 12 Write the syntax of switch statement. (2 times)
Ans. The syntax for writing switch statement is as follows:
switch(expression)
{
case value1:
statements1;
break;
case value 2:
statements 2;
break;
:
:
case value n:
statements n;
break;
default:
statements;
}
Q. 13 What is Conditional Operator?
Ans. Conditional operator is a decision-making structure. It can be used in place of simple "if-
else" structure. It is also called ternary operator because it uses three operands.
Q. 14 Differentiate between if….else and switch statement.
Ans. switch statement evaluates an expression that must have integer result. It executes one
case depending on the result of expression. The if-else statement evaluates an expression that
must have logical result. It executes the statement after condition if result is true and executes
the statement after else keyword if the result is false. Switch is more compact and readable.
Q. 15 Define if statement.
Ans. if is a keyword in C language. if statement is a decision-making statement. It is the
simplest form of selection constructs. It is used to execute or skip a statement or set of
statements by checking a condition.
Q. 16 Write two rules of using Switch Case in C program.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 33


I2 Past Paper Short Questions Chapter 11 Decision Constructs
Ans. The case label must integer or character. Each case label must be unique. A switch
statement can have only one default label. The default label can be used anywhere in switch
statement. The case label must end with colon. The default label is optional.
Q. 17 Name and describe three types of branching mechanisms.
Ans. Three types of branching mechanisms include if...else statement, multi-way if...else
statement and switch statement. An if...else statement selects between two alternative
statements based on a condition. A multi-way if...else statement evaluates several conditions
and selects one block of statements from many blocks. The switch statement evaluates an
expression and executes statements in the matching case label.
Q. 18 Define nested-if statement.
Ans. An if statement within an if statement is called nested if statement. In nested structure,
the control enters into the inner if only when the outer condition is true. Only one block of
statements are executed and the remaining blocks are skipped automatically.
Q. 19 Conver the following sentence into C expression.
“Marks are greater than 70 and less than 80”
Ans. marks > 70 && marks < 80
Q. 20 Find out the output of following code.
int a = 10, b = 12;
sum = a + b;
printf(“%d”, sum);
Ans. 22
Q. 21 Fine out error from the following code.
if (x == y ) then
printf(“yes”);
Ans. In first line there should be no use of word “then”.
Q. 22 Trace out the errors in the following code:
#include<stdio.h>
#include<conio.h>
void main( )
{
int x = 5, y = 10;
if(x = 4 || x  5 & x >y)
printf(“correct”);
else
Printf(“Incorrect”);
getch();
}
Ans. In line no. 6 this  symbol cannot be used in if statement.
Q. 23 Trace the output of the following program.
int a = 4, b = 2, c = 5;
a = 5;
if ( c = = a)
a = 6;
else
a = 7;
printf(“%d”,a);
Ans. 6

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 34


I2 Past Paper Short Questions Chapter 11 Decision Constructs
Q. 24 What is the output of the following code?
if(5/2 = 1)
printf(“Programming makes life interesting!\n”);
else
printf(“Programming makes life boring!\n”);
Ans. Programming makes life boring!
Q. 25 Find the errors in the given code.
void main( )
{ int a = 2
If(a = 1)
printf(“OK”);
Else
Printf(“Cancel”);
getch( ) }
Ans. In the second line semicolon is missing at the end of line. If and Else must be written in
lowercase. After getch( ) semicolon is missing.
Q. 26 Trace the output
void main( )
{
int marks;
printf(“\n enter your marks”);
scanf(“%d”,&marks);
if(marks > = 40)
printf(“\n Congratulation”);
}
Ans. If the user enter the value greater than 40 then it will display Congratulation otherwise
nothing will be print.
Q. 27 Trace the error in the following code.
int a; b;
a = 10, b = 5
if(a < b)
printf(“\n A is less than b”);
Ans. In first line there must be no semicolon after variable a. In second line there must be
semicolon at the end of line.
Q. 28 Trace the errors in the following code:
Void main( )
int x, z;
If (x > y);
Prinf f(“ x is largest”);
Else
Print f(“y is largest”);
getch( );
}
Ans. In first line V is capital in void.
In third line the I is capital in “if” statement and also there is semicolon at the end of
statement.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 35


I2 Past Paper Short Questions Chapter 11 Decision Constructs
In fourth line the P is capital in printf statement and also there is the space between
print and f.
x and y are not initialized.
Q. 29 Trace the output of the following codes:
int a = 4, b = 2, c = 5;
if(a > b)
a = 5;
if( c = = a)
a = 6;
a = 7;
Print f(“%d”,a);
Ans. 7
Q. 30 Trace the errors in the following code.
void main( )
{ int x = 3
int y = 4;
if ( x < y );
printf(“%d”,y);
}
Ans. In second line semicolon (;) is missing at the end of statement. On line 4 there should be
no semicolon (;) at the end of if statement.
Q. 31 Find Output from the following code:
void main( )
{ int a = 5;
if(a % 2 == 0 )
printf(“Even”);
else
printf(“Odd”);
}
Ans. Odd
Q. 32 Find the output of the following code.
int x = 10;
(x % 2 = = 0 ? printf(“Even”) : printf(“Odd”);
Ans. Even
Q. 33 Find errors in the following code:
int p = 5 q = 15;
if (p > q);
printf(“ q is larger “)
Ans. In first line comma(,) must be placed after 5.
In second line there should be no need of ;.
In third line semicolon (;) must be place at the end of line.
Q. 34 Trace output of following code:
int p,q,r;
p = 10; q = 3;
if(p % q == 3)
r = 0;
else

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 36


I2 Past Paper Short Questions Chapter 11 Decision Constructs
r = 1;
printf(“%d”,r);
Ans. 1
Q. 35 Determine output of the following code:
int x = 10;
int y = 20;
(x > y) ? printf(“%d is greater”,x) : printf(“%d is greater”,y);
Ans. 20 is greater
Q. 36 Determine output of the following code:
int x = 10, int y = 20;
if(x > 5 && y > 20)
printf(“Both greater”);
else
printf(“Both are not greater”);
Ans. Both are not greater
Q. 37 What is the output of the following code:
if ( 2 % 3 > = 1 )
printf (“Good”);
else
printf(“Bad”);
Ans. Good
Q. 38 Write the output of the following code:
if (50 < 20)
printf(“ ABC “);
printf(“ DEF” );
Ans. DEF

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 37


I2 Past Paper Short Questions Chapter 11 Decision Constructs

Long Questions
Q. 1 What is Control Structure? Briefly describe the basic control structures for writing
programs. (2 times)
Q. 2 What is nested if? Explain its working.
Q. 3 What is “Switch” Structure? Explain its working with example. / Explain Switch
statement with the help of a program. Also write its syntax and draw the flowchart. (2
times)
Q. 4 Define if statement. Explain if…else statement with example and diagram.
Q. 5 What is if – else statement? Write its syntax. Explain its working with example.
Q. 6 Write a program in C Programming language that accept three numbers form the
Keyboard and display the largest number.
Q. 7 Write a program that inputs temperature and displays a message according to the
following data:
Temperature Message
Greater than 35 Hot Day
Between 25 and 35(inclusive) Pleasant Day
Less than 25 Cool Day
Q. 8 Write a program that inputs a number and displays whether it is divisible by 3 or not?
Q. 9 Write a program that inputs marks and displays “congratulations” if marks are 40 or
more.
Q. 10 Write a program in C-Language to accept a year from the keyboard. Find out it is “Leap
Year” OR “Not Leap Year”. (Hint: Leap year is divisible by 4)
Q. 11 Write a program in C Language that inputs a number from user and finds whether it is
positive, negative or zero.
Q. 12 Write a Program in C to input single character during execution of program and show
either it is Vowel or Consonant.
Q. 13 Write a program that input day of week and print name of the day. If user enter 1 it print
Monday.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 38


I2 Past Paper Short Questions Chapter 12 Loop Constructs

Chapter 12
Loop Constructs
Q. 1 What is Loop? List three loops is C. (3 times)
Ans. A statement or number of statements that are executed repeatedly is known as loop. The
three loops are while loop, do…while loop and for loop.
Q. 2 What is counter controlled loop? (2 Times)
Ans. The counter-controlled loop depends on the value of a variable known as counter
variable. The value of counter variable is incremented or decremented each time the body of
loop executes. The loop terminates when value of counter variable reaches a particular value.
Q. 3 What is goto statement?
Ans. The goto statement is used to perform an unconditional transfer of control to a named
label. The label must be in the same function. a label is meaningful only to a goto statement.
Q. 4 What are two uses or advantages of Loop?
Ans. Loops are used to execute a statement or number of statements for a specified number of
times. Loops are used to access a sequence of values.
Q. 5 What is while loop? (4 times)
Ans. "While" loop is the simplest loop of C language. It executes one or more statements while
the given condition remains True. It is useful where the number of iterations is not known in
advance.
Q. 6 Differentiate Counter and Conditional Loops?
Ans. The difference between conditional loop and counter loop is that the number of
iterations of counter loop is known in advance. This Loop depends on the value of counter
variable. However, the number of iterations of conditional loop is unknown in advance. This
loop depends on the sentinel value.
Q. 7 Differentiate between For Loop and While Loop.
Ans. For loop is used when the number of iterations is known in advance. For loop is the best
in this situation. While loop is used when the number of iterations is not known in advance. In
this situation, the iterations are decided by the user so while loop is better
Q. 8 Define Do-While Loop.
Ans. The do-while is an iterative control in C language. It executes one or more statements
while the given condition is true. In this loop, the condition comes after the body of the loop.
The loop is important in a situation where a statement must be executed at least once.
Q. 9 Write General form or syntax of Do…While Loop.
Ans. The syntax of while loop is as follows:
do {
statement 1;
statement 2;
:
:
statement N;
}
while (condition);
Q. 10 What is Sentinel Value?
Ans. A special value used to terminate a sentinel-controlled loop is called sentinel value. For
example, a loop may execute while the value of a variable is not -1. Here -1 is the sentinel value
that is used to terminate the loop.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 39
I2 Past Paper Short Questions Chapter 12 Loop Constructs
Q. 11 Differentiate between while and do while loop. (2 times)
Ans. In while loop, condition comes before the body of the loop. In do-while loop, condition
comes after the body of the loop. If condition is false in the beginning, while loop is never
executed. do-while is executed at least once even if condition is false in the beginning.
Q. 12 Define Infinite Loop.
Ans. A loop in which the ending condition never occurs is called infinite loop. It repeats
forever until the user intervenes to stop the loop.
Q. 13 Write the syntax of “for” loop.
Ans. for (initialization; condition; increment/decrement)
{
statement 1;
statement 2;

statement N; }
Q. 14 Describe nested loop.
Ans. A loop within a loop is called nested loop. In nested loops, the inner loop is executed
completely with each change in the value of counter variable of outer loop. Any loop can be
used as inner loop of another loop.
Q. 15 What is "for" loop?/Define for loop. (3 times)
Ans. The for loop executes one or more statements for a specified number of times. This loop
is also called counter-controlled loop. It is the most flexible loop. That is why the most
programmers use this loop in programs.
Q. 16 What is a sentinel-controlled loop? (2 times)
Ans. Sentinel-controlled loop depends on special value known as sentinel value. The loop
terminates when the sentinel value is encountered. The number of iterations of sentinel-
controlled loop is unknown. It depends on the input from the user.
Q. 17 Convert the following loop into do-while loop;
i = 1;
while (i <= 4)
{
printf(“World”);
i++;
}
Ans. i = 1;
do
{
printf(“World”);
i++;
}while(i <= 4);
Determining the Output and Finding Errors
Q. 1 What is the final value of x after executing the following code?
for(int x = 0 ; x < 10 ; x++)
Ans. 10
Q. 2 What is Post Test Loop?
Ans. A posttest loop is a type of loop in which the condition is checked after executing the
body of the loop. It means that the statement in the loop will be executed at least once.
Q. 3 Trace the errors of the following code.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 40


I2 Past Paper Short Questions Chapter 12 Loop Constructs
Void main( )
{
int x, y = 5;
for( x = 0; x < 3; x ++)
if(y >= 5)
Printf(“%d”,x);
}
Ans. In first line v is capital in void.
In sixth line the p is capital in printf statement and also there is space between print and
f.
Q. 4 Convert the following do-while loop in for loop.
int c = 2;
do
printf(“%c”,c);
while(c++ < = 5);
Ans. for(int c=2;c<=5;c++)
printf(“%c”,c);
Q. 5 Trace out the output of the following piece of code.
#include<stido.h>
#include<conio.h>
void main()
{
inti,j;
clrscr();
for( i=1;i<=3;i++)
for(j=1;j<=4;j++)
printf(“\n %d \t %d”,I,j);
getch();
}
Ans. 1 1
1 2
1 3
1 4
2 1
2 2
2 3
2 4
3 1
3 2
3 3
3 4
Q. 6 Trace the output of following code.
intk,j;
for(k = 1;k<=5;k++)
{
for(j=0;j<k;j++)
{
Printf(“ * ”);
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 41
I2 Past Paper Short Questions Chapter 12 Loop Constructs
}
Printf(“\n”);
}
Ans. *
**
***
****
*****
Q. 7 Trace the output of following code.
inti,j= 10;
for(i = 1;i<=5;i++)
{
Printf(“%d %d \n”,i,j);
J=j-2;
}
Ans. 1 10
28
36
14 4
52
Q. 8 Trace the output of the following code:
int i, s = 0;
for(i= 10 ; i > 0 ; i - =1)
s+= i;
printf(“\n sum = %d”,s)
Ans. sum = 55
Q. 9 Trace the output of the following code.
int a = 1;
while(a < = 6)
{
printf(“\n a = %d”,a);
a + = 1;
}
Ans. a=1
a=2
a=3
a=4
a=5
a=6
Q. 10 Trace the Output.
int i, j;
for(i = 1 ; i < = 5; i++)
{
for(j = 1 ; j < = i; j ++)
printf(“ * “);
printf(“ \n”);
}
Ans. *
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 42
I2 Past Paper Short Questions Chapter 12 Loop Constructs
**
***
****
*****
Q. 11 Output of the following code?
int i = 1;
for(i = 3 ; i < 5 ; i++)
printf(“I am fine\n”);
Ans. I am fine
I am fine
Q. 12 Write the output of the following code.
void main( )
{ int i;
for (i = 1; i<=3; i++)
printf(“%d”,i*i);
}
Ans. 149
Q. 13 Convert the While loop into do-while loop.
int i = 1;
while (i < = 15)
{
printf(“Hello”);
i++;
}
Ans. int i = 1;
do
{
printf(“Hello”);
i++;
}while(i<=15);
Q. 14 Convert the following code in while loop.
for(int i = 3 ; i <= 9 ; I += 3)
printf(“\t%d”,i);
Ans. int I = 3;
while(i <= 9)
printf(“\t%d”,i);
Q. 15 Determine the output of following code:
int i;
i = 10;
while(i > = 10) {
printf(“%d”,i);
i++;
}
Ans. 10 11 12 13 14 15 ………. (infinite loop).
Q. 16 Determine the output of following code:
for(i = 1 ; i < = 15 ; i++)
if(i % 2 == 0)
printf(“%d ”,i);
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 43
I2 Past Paper Short Questions Chapter 12 Loop Constructs
Ans. 2 4 6 8 10 12 14
Q. 17 Trace out errors from following code:
int count;
count = 0;
while( i < = 10)
printf(“%d”,i)
Ans. In line no. 3 i should be replace with count.
In line no. 4 semicolon (;) should be place at the end of line.
Q. 18 Predict the output of the following code segment:
int x = 10;
for( x = 8 ; x > = 1 ; x−−)
printf(“ %d”, x % 2);
Ans. 0 1 0 1 0 1 0 1
Q. 19 Convert the following code into while loop:
i = 3;
do
{
Printf(“%d\n”,i);
i+=3;
while(i<=21);
}
Ans. i = 3;
while(i<=21)
{
Printf(“%d\n”,i);
i+=3;
}

Long Questions
Q. 1 What is Loop? Explain working of while loop structure with a program. / What is While
Loop? Explain its working with the help of example, syntax and flowchart. (2 times)
Q. 2 Define Do-While Loop? Explain its working with Flow Chart and example. / Define Do-
While loop. Write its syntax and its working. (2 times)
Q. 3 Define for loop. Give its syntax and flow chart. Also explain its working using an
example. (2 times)
Q. 4 What is Nested Loop in C-Language? Explain with the help of example.
Q. 5 Write a program that displays first five numbers and their sum using while loop.
Q. 6 Write a program that gets starting and ending point from the user and display all odd
number in the given range using do-while loop.
Q. 7 Write a program that inputs a number from the user and display the factorial of that
number using while loop.
Q. 8 Write a program that inputs a number and displays its divisor.
Q. 9 Write a program to print Odd numbers from 1 to 20 using loop.
Q. 10 Write a program in C-Language that inputs a number from user and displays a table of
that number. Suppose the number is 5. The output will be as follows: (2 Times)
5*1=5
5 * 2 =10
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 44
I2 Past Paper Short Questions Chapter 12 Loop Constructs
.
.
.
5 * 10 = 50
Q. 11 Write a program in C to display the following series using loop:
0 2 4 6 8 10 12 14 16

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 45


I2 Past Paper Short Questions Chapter 13 Function in C

Chapter 13
Function in C
Q. 1 Define Function. (5 times)
Ans. A function is a named block of code that performs some action. The statements written
in a function are executed when it is called by its name. Each function has a unique name.
Functions are the building blocks of C programs. The real reason of using functions is to divide
a program into different parts. These parts of a program can be managed easily.
Q. 2 What is function call? (6 times)
Ans. The statement that activates a function is known as function call. A function is called
with its name. Function name is followed by necessary parameters in parentheses. If there are
many parameters, these are separated by commas.
Q. 3 How a function return a value?
Ans. A function returns single value. The return type in function declaration indicates type of
value returned by function. return keyword is used to return a value to calling function.
Q. 4 What do you know about function body? (2 times)
Ans. The set of statements which are executed inside the function is known as function body.
The body of function appears after function header. The statements are written in curly braces {
}. The variable declaration and program logic are implemented in function body.
Q. 5 Differentiate between SCOPE and LIFETIME of variable.
Ans. The area where a variable can be accessed is known as scope of variable. The time period
for which a variable exists in the memory is known as the lifetime of variable.
Q. 6 Describe the use of parameters in functions./What is Function Argument?
Ans. Arguments/Parameters are the values provided to the function when it is called. The
parameters used in function call are called actual parameters. These parameters are used to
send values to function. The parameters in function declaration are called formal parameters.
These parameters are used to receive values from calling function.
Q. 7 What is the use of Actual Parameter?
Ans. The parameters used in function call are called actual parameters. These parameters are
used to send values to the function. If two or more actual parameters are used, each parameter
is separated by comma.
Q. 8 Differentiate between Formal Parameter and Actual Parameters. (2 times)
Ans. Formal parameters are used in function header but actual parameters are used in
function call. Formal parameters receive values passed to the function and actual parameters
are the values that passed to function.
Q. 9 What is Function Declaration or Function Prototype? (2 Times)
Ans. Function declaration is a model of a function. It is also known as function prototype. It
provides information to compiler about the structure of the function to be used in program. It
consists of function name, function return type and number and types of parameters.
Q. 10 Why we use Prototype in Functions?
Ans. We use prototype in functions because it provides information to compiler about the
structure of the function to be used in program. It consists of function name, function return
type and number and types of parameters.
Q. 11 What is the difference between function definition and function declaration? (2 times)
Ans. Function definition consists of different statements to perform a task. Function
declaration consists of single statement that provides information to compiler about function.
Function declaration is written in braces but function definition is not written in braces.
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 46
I2 Past Paper Short Questions Chapter 13 Function in C
Q. 12 How does programming make easier?
Ans. A lengthy program can be divided into small functions. It is easier to write small
functions instead of writing a long program. A programmer can focus the attention on a
specific problem. It makes programming easier.
Q. 13 How a function returns value?
Ans. A function returns single value. The return type in function declaration indicates type of
value returned by function. return keyword is used to return a value to calling function.
Q. 14 List some benefits of using functions./Write down any two importance of Functions.
(4times)
Ans. The benefits of using functions are:
▪ Easier to Code
▪ Easier to Modify
▪ Easier to Maintain & Debug
▪ Reusability
Q. 15 Define Function Header.
Ans. The first line of a function definition is known as function header. The function header
consists of return type, function name and parameters.
Q. 16 Differentiate between Global Variable and Local Variable. (2 times)
Ans. Local variables are declared in a function but global variables are declared outside any
function. Local variable is created when the control enters the function but global variable is
created when the program starts
Q. 17 Define Local Variable. (3 times)
Ans. A variable declared inside a function is known as local variable. Local variables are also
called automatic variables.
Q. 18 Define Scope of a Variable.
Ans. The area where a variable can be accessed is known as scope of variable.
Q. 19 How can a function be called that returns a value?
Ans. The general form of function call that returns a value is as follows:
Variable = function_name(list of arguments);
Q. 20 What is Built-in function? (2 times)
Ans. A type of function that is available as a part of language is known as built-in function or
library function. These functions are ready-made programs. These functions are stored in
different header files. Built-in functions make programming faster and easier.
Q. 21 Why we use Prototype in Functions?
Ans. It provides information to compiler about the structure of the function to be used in
program. It consists of function name, function return type and number and types of
parameters.

Long Questions
Q. 1 What are Functions? Briefly discuss the importance of functions.
Q. 2 What is local variable? Describe its syntax, lifetime and scope in C language.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 47


I2 Past Paper Short Questions ATP Question

Chapter 14
File Handling in C
Q. 1 What is meant by File Handling in C-Language?
Ans. We frequently use files for storing information which can be processed by our programs.
In order to store information permanently and retrieve it we need to use files. Files are not only
used for data. Our programs are also stored in files.
Q. 2 What is meant by fgets() function?
Ans. Data can be read from text file one character at a time by using fgetc function. Its syntax
is as follows: ch = fgetc(File_Pointer);
Q. 3 Write the prototype of fopen function used for opening a file.
Ans. The function fopen is used to open a file. Its prototype is as follows:
File_Pointer = fopen(File_Name, Mode);
In the prototype, File_Pointer is the name of file pointer declared in the program.
File_Name is the name of data file to be opened. Mode indicates the mode in which the
file is to be opened.
Q. 4 What is stream?
Ans. A logical interface to a file is known as stream. A stream is associated with a file using an
open operation. The stream is disassociated from a file using a close operation.
Q. 5 What is binary stream? (2 times)
Ans. A binary stream is a sequence of bytes. The translation is not performed in binary
stream. It exists with a one-to-one correspondence to the external devices. It means that the
number of bytes written or read is the same as the number of bytes on the external device.
Q. 6 What is the use of EOF in files? (2 times)
Ans. A text file a named collection of characters saved in secondary storage such as disk. The
text file has no fixed size. A special end-of-file character is used to indicate the end of a text file.
It is placed after the last character in the file. It is denoted by EOF in C language.
Q. 7 Differentiate between Text Stream and Binary Stream.
Ans. Text stream is a sequence of characters but binary stream is a sequence of bytes. A
certain character translation may occur in a text stream but not in binary stream. Text stream
does not have one-to-one relationship with external devices but binary steam has a one-to-one
relationship with external devices. Text stream is more efficient than binary stream.
Q. 8 Define pointers.
Ans. A type of variable that is used to store the memory address of a memory cell is known as
pointer. It normally stores the memory address of a variable or object. The data type of a
pointer must be the same as data type of the variable whose memory address is stored in it.
Q. 9 What is a Text File?
Ans. A type of file that stores data as readable and printable characters is called text file. A
source program of C language is an example of text file. The user can easily view and read the
contents of a text file. It can also be printed to get a hard copy.
Q. 10 Why is it important to close a file? (2 times)
Ans. Each opened file occupies memory. It is important to close a file because an opened file
occupied memory. Closing of file releases the memory occupied by file.
Q. 11 Write the syntax of Closing a File. (2 times)
Ans. fclose(file_pointer);
where file_pointer is the file pointer that refers to the file to be closed.
Q. 12 What is meant by string handling?
Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 48
I2 Past Paper Short Questions ATP Question
Ans. String handling means performing different operations on string.

Prepared By: Adnan Hameed Qureshi Sadiq Public School, Bahawalpur 49

You might also like