0% found this document useful (0 votes)
16 views18 pages

Inter Part II Short Questions Notes

Intermediate part two short questions k notesh Hein ye for second year

Uploaded by

shazwaadan822
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)
16 views18 pages

Inter Part II Short Questions Notes

Intermediate part two short questions k notesh Hein ye for second year

Uploaded by

shazwaadan822
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/ 18

CHAPTER NO.

1 (2nd year) page 1


IMPORTANT SHORT QUESTIONS
Q. Define Database.
Ans: A Database is a collection of logically related data sets or files.
Q. Define DBMS.
Q. Define Program File.
Ans: A type of file that contains software instructions is called program file. A program file has
the extension of .com or .exe.
Q. Define Field. Given an example.
Ans: A combination of one or more characters is called field. It is smaller unit of data that can be
accessed by user.
Example: Roll No. , Name, address are called fields.
Q. Define the term redundancy.
Ans: Redundancy means duplication of data in multiple files.
Q. List two advantages of DBMS.
Ans:
 It provides data security
 It provides backup and recovery of data
Q. Define Data Integrity.
Ans: Data integrity means that data entered in the database is accurate and consistent.
Q. What is meant by data inconsistency?
Ans: Data inconsistency means that two files may contain different data of same entity.
Q. What is the purpose of index file?
Ans: Index file contains an index in a file. It stores records in ascending or descending order
based on a key value. It is used to access and search the data quickly.
Q. List two examples of Database Systems.
Ans: 1) NADRA Database 2) College Database 3) Library Management System
Q. Differentiate between Data and Information.
Ans:
DATA INFORMATION
1) Collection of raw facts and figure is called 1) Processed form of data is called information
Data.
2) Data is input to the computer 2)Information is the output of the computer
3) Data does not depend on information 3) Information depends on data
Q. What is data processing?
Ans: The process of manipulating data to convert it into information is called data processing.
Software is used to convert the raw data into useful information.
Q. List different activities in data processing:
Ans: Different activities in data processing are:
 Data Capturing
 Data Manipulation
 Managing output results
Q. Define Transaction File.
Ans: A file that stores the input data before processing is called Transaction File. It is may be
temporary file. It contains the record of a transaction.
Example: cash deposit in the bank stored in a transaction file.
Q. Define Backup File.
Ans: A type of file that is used to store additional copy of important data is called backup file.
Backup file is used to recover the data, if original file is lost or damaged.
Chapter 1 (2nd year) page 2
Define DBMS
Ans: A Database Management System is a collection of programs that are used to create, maintain
and access database in efficient manner.
Example: MS Access is a DBMS.
Q. Write Names of Database Model.
Ans:
1. Hierarchical Model
2. Network Model
3. Relational Model
Q. What do you mean by file organization?
Ans: A technique for physically arranging the records of a file on secondary storage devices is
called File Organization.
Q. List file types from Usage point of View.
Ans: Files types from usage point of view are:
 Master file
 Transaction File
 Backup file
Q. Name file organization from storage point of view?
Ans:
 Sequential File
 Random File
 Indexed Sequential File
Q. What are the advantages of database approach over traditional file approach?
Ans: Following are the advantages of database approach over traditional file approach”
1) Data consistency 2) Data integrity 3)Data independence
4) Data security 5)Data sharing
Q. Differentiate between Database and DBMS
Ans:
Database: Database is a collection of related data
DBMS: DBMS is a collection of programs used to create, maintain and access database.
Q. What is the use of Data Dictionary?
Ans: Data Dictionary is used to store the definition or description of data used in the database.
Q. What is the use of query language?
Ans: A query language is used to perform different operations on databases.
Example: SQL is a popular query language.
Q. Write any five commands of query language.
Ans: SELECT, DELETE, UPDATE, CREATE, INSERT
Q. What do you mean by term data independence?
Ans: Data Independence means that data and application programs are separate from each other.
User can change the data without changing the application programs or user can modify the
programs without changing the data.
Q. What is the use of DDL?
Ans: DDL stands for Data Definition language. It consists of SQL commands used create
database, tables, indexes and views. e.g. CREATE/DROP TABLE, CREATE/DROP VIEW
Q. What is the use of DML?
Ans: DML stands for Data Manipulation Language. It consists of SQL commands used to insert,
update and delete data from databases.
Example: INSERT, UPDATE, DELETE
Q. What is the use of DCL?
Ans: DCL stands for Data Control Language. It consists of SQL commands used to establish
access to database. e.g. GRANT, ADD USER

CHAPTER NO.2
Q. What is entity? Give an example:
Ans: An Entity is anything about which information is stored in the Database.
Example: STUDENT, TEACHER, COLLEGE are examples of entities.
Q. Define the term Table (Relation).
Ans: A two-dimentional array of data that consists of rows and columns is known as Table or
Relation. These relations are used to store information about an entity.
Q. Write four properties of a relation.
Ans:
 No duplicate rows exist.
 The order of rows is insignificant
 The order of columns is insignificant
 All columns/rows are atomic
Q. Describe the basic purpose of using views.
Ans: A view is a virtual table that displays data from one or more tables. The basic purpose of
using views is to keep data safe and secure from un-authorized and illegal user.
Q. What is key?
Ans: A key is an attribute or set of attributes that uniquely identifies a row (record) in a relation.
Example: Student Registration Number is called Key.
Q. Define Primary Key.
Ans: An attribute or set of attributes that uniquely identifies a row or record in a relation is called
primary key.
Example: Student Roll No. and Registration Number are examples of primary keys.
Q. Write three important characteristics of primary key.
Ans:
 A relation can have only one primary key.
 Each value in the primary key attribute must be unique.
 Primary key cannot contain Null values.
Q. What is secondary key?
Ans: An attribute or set of attribute that can be used to access records is called Secondary Key.
Secondary key values may not be unique.
Example: Student Name is an example of Secondary Key.
Q. Define Composite Key / concatenate key.
Ans: A primary key that consists of two or more attributes is known as composite key.
Q. Define Candidate Key.
Ans: An attribute or set of attribute that can be used as primary key is called candidate key.
Q. Define Alternate Key.
Ans: The candidate keys that are not selected as primary key are called alternate keys.
Q. Define foreign key.
Ans: A foreign key is an attribute or combination of attribute whose values match a primary key
in another relation.
Q. Who is database administrator (DBA)/ What are responsibilities of DBA?
Ans: Database Administrator (DBA) is a person who is responsible for design, implementation,
operation and maintenance of database. He must be technically competent and a good manager.

. What is the difference between candidate key and Primary Key.

Ans:
Primary Key Candidate Key
An attribute or set of attributes that uniquely An attribute or set of attribute that can be used
identifies a row or record in a relation is called as primary key is called candidate key
primary key
There is only one primary key in every table There may be many candidates key in a table
Example: Roll No. Example: Student B-form number
Q. Who is end-user?
Ans: End user is the person who directly interacts with the database system. End user may not
have the technical knowledge of database system.
Q. State the use of index in FMS.
Ans: An index is a data structure that is used to locate a particular record in a file more quickly.
Indexes are used to speed up the sorting and searching process.
Q. Who is Data Administrator?
Ans: A Data Administrator is a person who is responsible for entire data of an organization. He
normally develops overall functional requirements for database. He controls and manages the
whole database system.
Q. Define attribute. Give an example.
Ans: The characteristics of an entity are called attributes. An entity may have many attributes.
Example: STUDENT entity have attributes Student Roll No, student name, address and marks.

Q. How relation is formed in a database?


Ans: The attributes of entity become the fields of relation. The name of entity becomes the name
of relation.
Q. List any four types of keys.
Ans: 1) Primary Key 2) Secondary Key 3) Candidate Key 4) foreign key
CHAPTER NO.3 (2nd Year)
Q. What is entity or object? Give two examples of entity.
Q. What is relationship?
Ans: A logical connection between different entities is called relationship.
Example: A relationship between TEACHER and STUDENT exists because Teacher teaches students.
Q. List different types of relationships.
Ans: The relationship can be
 One-to-one :
 One-to-many
 Many-to-many
 Recursive
Q. What is meant by cardinality of a relationship?
Ans: The maximum number of instances of one entity associated with each instance of the related
entity is known as cardinality of relationship.
Q. Define modality with the help of figure.
Ans: The minimum number of instances of one entity associated with each instance of the related
entity is known as cardinality of relationship. It describes relationship as mandatory ( | ) or
optional (O).
Q. Define ER diagram.
Ans: ER diagram is used to represent entities, attributes and their relationships in a database
system.
Q. What is the difference between relation and relationship?
Ans:
Relation: A two-dimentional array of data that consists of rows and columns is known as Table or
Relation. Relation or table is used to store information about an entity.
Relationship: logical connection between different entities is called relationship.
Q. Name the symbols used in ER diagram.
Ans: Different symbols are used in E-R diagram. Rectangle is used for Entity. An oval is used for
attributes and Diamond is used for relationship.
Q. List different data distribution strategies.
Ans: There are four data distribution strategies which are
 Centralized
 Partitioned
 Replicated
 Hybrid
Q. What is the purpose of Analysis?
Ans: The basic purpose of analysis is to study the existing system and to know which activities
are performed in the current system.
Q. What is feasibility study? / why feasibility study is used?
Ans: Feasibility study is conducted to check whether proposed system is affordable, possible and
acceptable.
Q. What is the purpose of logical database design?
Ans: The logical design describes the data stored in the database. It contains the definition of data
to be stored in the database.
Q. What is entity class and entity instance?
Ans: Entity Class: A group of entities of the same type is called entity class. e.g. STUDENT is
entity class
Entity Instance: A member of an entity class is called entity instance. e.g. AHMAD is entity
instance.
CHAPTER NO.4 (2nd Year)
Q. What do you mean by data integrity?
Ans: Data integrity means that data entered in the database is correct and consistent. It is
maintained with the help of integrity constraints.
Q. What is Entity integrity?
Ans: Entity integrity means that primary key cannot contain NULL value. It is because primary
key is used to uniquely identify a record in the relation(table).
Q. What is refrential integrity?
Ans: Referential integrity is a constraint on the foreign key. Referential integrity means that
foreign key value must match the primary key value of some records in the parent table.
Q. Define Synonym.
Ans: A synonym is a type of problem in the relation that occurs when two different names are
used for the same attribute.
Q. Define homonym.
Ans: A homonym is a type of problem in the relation that occurs when same name is used for the
two different attribute.
Q. What are database anomalies?
Ans: Database anomalies are the problems in relations that occur due to redundancy in the
relations. Following are the database anomalies
 Insertion anomaly
 Deletion anomaly
 Modification anomaly
Q. Define Normalization.
Ans: The process of producing simple and more reliable database structure is called
Normalization.
Q. What is functional dependency ? Give Example.
Ans: A functional dependency is a relationship between two attributes. It means that if value of
one attribute is known, it is possible to get the value of other attribute.
Example: Roll No ------ Marks
Q. Define Partial dependency.
Ans: In partial dependency two or more non-key attributes are functionally dependant on the part
of primary key.
Q. Define Transitive dependency.
Ans: When two or more non-key attributes are functionally dependent on each other in a relation,
it is called transitive dependency.
Example: A ------- B , B---------C, it means that A-----------C
Q. Define Determinant:
Ans: The attribute that is used to get the value of other related attributes is called Determinant. It
appears on the left side of the arrow (). Example: for example Roll No Name, Marks
In the above example Roll No is called Determinant.
Q. How 1NF is achieved?
Ans: first Normal Form 1NF is achieved by removing the Repeating Groups.
Q. How 2NF is achieved?
Ans: 2NF is achieved when relation is in 1NF and partial dependency is removed.
Q. How 3NF is achieved?
Ans: 3NF is achieved when relation is in 2NF and transitive dependency is removed.
CHAPTER NO.5 (2nd Year)
Q. What is MS Access?
Ans: Microsoft Access is a popular database management system. It is used to create, access and
maintain the databases.
Q. What do you mean by IDE? / Write advantages of IDE.
Ans: IDE means Integrated Development Environment.
1. It provides the facility to create database application easily.
2. It is easy to use
Q. What do you know about RDBMS?
Ans: RDBMS stands for Relational Database Management System. It is collection of programs
that are used to create and maintain relational databases.
Q. What is Database Wizard?
Ans: A database wizard is a set of steps that guides the user to create a database easily.
Q. What is Database Object? Write names of database objects. (v.imp)
Ans:
A components of database system is known as database object.
Example: Table, Forms, Reports and queries.
Q. Define Query.
Ans: A query is a statement that is use to get information from the database. Queries are used to
enter, search or get the data from the database.
Q. Define Form.
Ans: Form is a database object. It is graphical interface used to interact with the database. It is
used to enter, retrieve, delete or update the data in database.
Q. What are Reports?
Ans: Report is a database object. Reports are the outputs of database application. Reports are used
to present the data in formatted way.
CHAPTER NO.6 (2nd Year)
Q. Define the term table /relation is database.
Ans: A two-dimentional array of data that consists of rows and columns is known as Table or
Relation. These relations are used to store information about an entity.
Q. Write four properties of a relation.
Ans:
 No duplicate rows exist.
 The order of rows is insignificant
 The order of columns is insignificant
 All columns/rows are atomic
Q. What is the degree of a relation?
Ans: The number of fields (columns) in a relation is called degree of a relation.

Q. Define the term Cardinality of a relation?


Ans: The number of Records (rows) in a relation is called cardinality of a relation.

Q. Name two table views available in MS Access.


Ans:
1. Design View
2. Datasheet View

Q. How datasheet view is different from the design view?


Ans: Datasheet view is used to enter records into a table while design view is used to design the
fields and properties of the table.

Q. List out different data types in MS Access.


Ans: Different data types in MS Access are Text, Number, Auto Number, Data/Time, Currency.

Q. Define sorting.
Ans: The process of arranging data in a sequence is known as Sorting.
CHAPTER NO.7 (2nd Year)
Q. List some uses of Form.
Ans:
Form is used to manipulate data in database.
Form is used to enter, delete, update data in the database

Q. Write Advantages of Form.


Ans:
Form is easy to use.
Form is used to enter, delete, update data in the database.
It is time saving.

Q. List different types of Form in MS Access


Ans: Different types of Forms in MS Access are
1. Columnar Form
2. Tabular Form
3. Datasheet Form
4. Justified Form

Q. Why is List Box used in the Forms?


Ans:
List box is used to display a list of items in forms. User can select item from the list box.

Q. What is Combo Box?


Ans:
Combo box is used to display a list of items in forms. It consist of a text box and drop down
list.User can select item from the Combo Box.
Q. What are check boxes
Ans:
Check Box is used to display YES/No, TRUE/ FALSE or NO/OFF Option. It is used to select one
or multiple items at a time.

Q. What are Radio Buttons?


Ans:
Radio Button is also known as Option Box. It is used to display YES/No, TRUE/ FALSE or
NO/OFF Option. It is used to select one option at a time.

Q. Differentiate between Form and Report.


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 database.
CHAPTER NO.8 (2nd Year) page 1
Q. What is ANSI C?
Ans:
The American National Standard Institute (ANSI) developed standard version of C Language.
This version is known as ANSI C.
Q. List Three Characteristics of C Language.
Ans:
 Easy to use
 Easy to learn
 Machine Independence
Q. What do you mean by Machine Independence?
Ans:
Machine Independence means that programs written in one language can be executed on different
types of computers.
Example: For example program written in C language can be executed on Intel Processor or
Motorola Processor.
Q. Define Program.
Ans:
A well defined set of instructions given to the computer is called computer program. A computer
program is written in programming language.
Q. Who is Programmer?
Ans:
A person who develops computer program is called programmer.
Q. Write two main categories of Programming Languages.
Ans:
Low Level Language
High Level Language
Q. Difference between Low Level Language and High Level Language
Ans:
Low Level Language High Level Language
A Language that is close to hardware and far A Language that is close to human language is
from the human language is called Low Level called High Level Language
Language
Instructions low level language are in binary Instructions written in High Level Language are
form like English language.
Example: Machine Language is low level Example: C / C++ is a high level language
language

Q. What is Machine Language?


Ans:
Machine Language is a low level language. Instructions in machine language are in binary form
(0,1). Computer can understand machine language directly without any translator.
Q. What is Assembly Language?
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. Write Names of High Level Languages.
Ans:
C / C++
Java
BASIC
Pascal
CHAPTER NO.8 (2nd Year) page 2
Q. What is meant by Language Processor (Language Translator)?
Ans:
Language processor or translator is a program that converts the High level Language program into
machine code. Every computer language has its own language translator.
Q. List different types of Language Translators (Language Processors)
Ans: There are three types of Language Translators
 Assembler
 Compiler
 Interpreter
Q. What is Assembler?
Ans: Assembler is a translating program that converts Assembly Language into Machine Code.
Q. What is Compiler?
Ans: Compiler is a translating program that converts High Level Language into Machine Code as
a whole.
Q. What is Interpreter?
Ans: Interpreter is a translating program that converts High Level Language into Machine Code
line by line. Speed of interpreter is slow than complier.
Q. Distinguish between Source Code and Object Code.
Ans:
Source Code Object Code
A program written in high level language is A program written in machine language is
called source code. called object code.
Source code is easy to understand and modify Object code is difficult to understand and
modify
Q. C is a case sensitive language. What does it mean? (important)
Ans:
It means that C language can differentiate between uppercase and lowercase words. All keywords
are usually written in lowercase.
Q. What is the purpose of linker in C language? (important)
Ans:
The purpose of Linker in C language is to combine the object program with library files. Linker is
a part of compiler.
Q. What is the process of Linking in C programs?
Ans:
The process of Linking library files with object program is known as Linking. The library files
must be linked with the object file before executing the program.
Q. What is an executable file?
Ans:
An executable file is saved with the .exe extension on the disk. This file execute on the computer.
Q. What kind of errors does linker detect?
Ans: The Linker detects errors related to library functions.
Q. Write shortcut key to compile C program
Ans:
The shortcut key to compile C program is ALT+F9
Q. Write shortcut key to run C program
Ans:
The shortcut key to run C program is CTRL+F9
Q. What are preprocessor directives? (important)
Ans:
The preprocessor directives are the commands that give instruction to C preprocessor. The
preprocessor directives are processed by a program called preprocessor. These start with a #
symbol and keyword include or define. These directives are written at the start of the program.
CHAPTER NO.8 (2nd Year) page 3
Q. What is the purpose of #include <stdio.h> in C program?
Ans:
The purpose of statement is to tel the compiler to include header file stdio.h in the program. This
header file contains the definition of printf( ) and scanf( ) functions.
Q. How a header file is included in C program?
Ans:
The preprocessor directive include is used to add a header file in a program.
Example: #include <stdio.h>
Q. Name two types of preprocessor directives.
Ans:
Two types of preprocessor directives used in C program are include and define.
Q. What is the use of include preprocessor directive.
Ans:
The purpose of include preprocessor directive is to add a header file in a source program.
Example: # include <stdio.h>
Q. What is the use of define preprocessor directive.
Ans:
The define directive is used to define a constant. It starts with a # symbol.
Example: # define PI 3.14
Q. What are header files?
Ans:
Header files are collection of standard library functions to perform different tasks. Header files
contain different library functions.
Example: stdio.h
Q. Define the term bug or debug.
Ans:
An error in a program is known a Bug.
The process of finding and removing bugs is called debugging.

Q. How many types of errors can occur in a Computer program.


Ans:
Three types of errors can occur in a Computer Program. These are
1. Syntax Errors
2. Runtime Errors
3. Logical Errors

Q. What do you mean by delimiters?


The statements of the C program are written in curly braces. The curly brace { is called opening
brace and } is called closing brace. These braces are known as delimiters.

Q. What is difference between Unstructured and Structured Programming Languages?


Ans:
Unstructured Programming Language Structured Programming Language
In Unstructured Programming Language, the In Structured Programming Language, the
entire logic of program is implemented using entire logic of program divided into number
single module(Function) of modules(functions)
It is difficult to understand It is easy to understand
It is difficult to debug It is easy to debug
CHAPTER NO. 9 (2nd Year) page 1

Q. What is an identifier? Give Example


The identifier is the name given to the variable, constants or function in a program. The first 31
characters of the identifier are significant to the C Compiler.
Example: Student_Age, item20, Sum are some examples of identifier.
Q. How many types of identifiers are used in C language?
There are two types of identifiers in C language. These are
Standard identifier
User-defined identifier
Q. What is standard identifier? Give Example
A type of identifier is that has special meaning in C language is called Standard identifier. It is
pre-defined in C language.
Example: printf( ) and scanf( ) are some examples of standard identifier.
Q. What is user-defined identifier? Give Example
A type of identifier is that has is defined by the by the programmer is called user-defined
identifier. User-defined identifiers are used to store data and program results.
Example: Some examples of user-defined identifier are num, age, marks.
Q. What is keyword? Give Example
Keyword is a word in C language that has pre-defined meaning and purpose. It is defined by the
developer of the language. It cannot be changed or re-defined by the user. Keywords are also
known as reserved words. There are 32 keywords in C language.
Example: if, while, int are some examples of keywords.
Q. How can you differentiate between keyword and identifier?
Keyword Identifier
Keywords are the words that have pre-defined The identifier is the name given to the variable,
meaning and purpose. constants or function in a program.
Keywords are defined by the developer of the Identifier are defined by the programmer
language
Q. What do you mean by delimiters?
The statements of the C program are written in curly braces. The curly brace { is called opening
brace and } is called closing brace. These braces are known as delimiters.
Q. What is variable? Why it is used in program?
A variable is a named memory location or memory cell. It is used to store input data and program
results. The value of variable may change during the execution of program.
Q. Why C is known as 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. Define declaring a variable (variable declaration) and defining a variable?
Variable Declaration Variable Definition
Variable declaration specifies the name and Variable definition specifies the name and type
type of variable to the compiler. of variable to the compiler.
It does not set aside memory location It set aside memory location for variable
Q. What do you know about data type?
Data type specifies the type of data that can be stored in a variable. It also defines the set of
operations on data.
Example: char , int , float , double are examples of data types.
Q. List any four data types in C language.
Following are data types used in C language
char int float double
Q. Define variable initialization. How is a variable initialized?
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.
CHAPTER NO. 9 (2nd Year) Page 2
Q. List any two differences between variable and constant.
Variable Constant
Variable is a named memory location Constant is a named value
Value of variable can change during program Value of constant cannot change during
execution program execution
Q. Write any three rules for declaring variables in C language.
1. The first character of the variable must be a letter or underscore.
2. Blank spaces are not allowed in variable name.
3. Keywords are not used as variable names
Q. What does cancellation error occurs?
The cancellation error occurs due to manipulation of very large and very small floating point
numbers. The large number may cancel out the smaller number if both numbers are added.
Example: if we add the numbers 1970.0 and 0,0000001234 the result is 1970.000000. The value
0.0000001234 has been cancelled in this calculation.
Q. How does an arithmetic underflow occurs?
Arithmetic underflow occurs due to manipulation of two very small numbers. The result may be
too small to be represented. The result is represented as zero.
Example: multiply the numbers 0.000002 and 0.000005 gives the result as 0.0000
Q. How does an arithmetic overflow occurs?
Arithmetic overflow occurs due to manipulation of two very large numbers. The result may be too
large to be represented in a variable.
Q. What is the use of operator? List different types of operators in C language.
Operators are symbols used to perform operations on data.
There are following types of operators used in C language
Arithmetic operators ( +, - , * , / )
Relational operators ( < , >, ==, <=, >=, != )
Logical operators ( AND &&, OR | | , NOT ! )
Q. What is relational operator? List six relational operators in C language.
Relational operators compare values and give result as true or false.
Six relational operators are < less than, > greater than, == equal to, <= less than equal to
>= greater than equal to , != not equal to
Q. What is compound condition? Give example.
In compound condition two or more conditions are evaluated.
Example: if (a>50 && a<100)
Q. What is expression?
A statement that evaluates to a value called expression. An expression give a single value. An
expression consists of operator and operands.
Example: 4+3*5/2 is example of expression
Q. What is the use of increment operator?
The increment operator is used to increase the value of variable by 1. It is denoted by the
symbol ++. It is unary operator and works with single variable.
Example: ++a ( prefix increment operator) a++ (postfix increment operator)
Q. What is the use of decrement operator?
The decrement operator is used to decrease the value of variable by 1. It is denoted by the
symbol - -. It is unary operator and works with single variable.
Example: --a ( prefix decrement operator) a-- (postfix decrement operator)
Q. What are comments in C program? / Why comments are used in program.
Comments are lines of program that are not executed. The compiler ignores comments and does
not include them in executable program.
Comments increase the readability of program. Comments helps in debugging.
Q. How comments are added on single line or multiple lines.
Comments are added on single line by using double slash / /
Comments are added on multiple line by using / * and * / symbols.
CHAPTER NO. 11 (2nd Year) page 1

Q. Define control structure. (v.imp)


Ans: A statement used to control the flow of execution in a program is called control structure.
There are following types of control structures:
 Sequence
 Selection
 Repetition (Loop)
Q. Describe Switch statement (v.imp)
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 statement is useful where
selection is based on the value.
Q. Write the syntax of switch statement. (v.imp)
Ans: Syntax of switch statement is as follows:
switch(expression)
{
case 1:
statements 1;
break;
case 2:
statements 2;
break;
.
.
case n:
statements n;
break;
default:
statements;
}

Q. What is conditional operator? Write its syntax. (v.imp)


Ans: Conditional operator is a decision-making structure. It can be used in place of simple “if-
else” structure. It is called ternary operator because it uses three operands. The Syntax of
conditional operator is as follows:
Syntax: (condition)? True-case statement : false-case statement
Q. Why break statement is used in switch statement? (v.imp)
Ans: The break statement is used in each case to exit from the switch body. If break is not used,
all case block coming after matching case will also be executed.
Q. What happens if break is missed in each case block?
Ans:
If break is not used, all case block coming after matching case will also be executed.
Q. Write three advantages of switch statement.
Ans:
 The switch statement is easier to use when there are multiple choices.
 It is easier to understand.
 It is easier to maintain.
Q. Describe sequence structure or describe sequential structure.
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. Define Compound statement.
Ans: A set of statements written in curly brackets { } after if statement is used is called compound
statement.
CHAPTER NO. 11 (2nd Year) page 2

Q. Define selection structure.


Ans: A selection structure selects a statement or set of statement to execute on the basis of a
condition.
There are three types of selection structures. These are if, if-else, switch
Q. Explain if statement.
Ans: if statement is a decision making statement. It is a simplest form of selection structure. It is
used to execute or skip a statement or set of statements by checking a condition.
Q. Write the syntax of if-else statement.
Ans:
Syntax: if (condition)
statement;
else
statement;
Q. What is multiple If-else-if statement? (imp)
Ans: The if-else statement used within another if-else statement is called multiple if-else
statement. It is used when there are many choices available and only one statement should be
executed.
Q. What is repetition structure? Write names.
Ans: A repetition structure executes a statement or set of statement repeatedly. It is also known as
loop. There are following repetition structures.
for loop
while loop
do-while loop.
Q. When you must use curly braces { }?
Ans: Curly braces { } are used when a compound statement is written.
Q. What is the use of default label in a switch statement?
Ans: The default label is used to execute a statement or set of statements when the condition does
not match with any case in switch statement.

CHAPTER NO. 10 (2nd Year) important questions from book


Q. Define Standard Input.

Q. List some commonly used input functions.

Q. Define standard output.

Q. List some commonly used output functions.

Q. What are format specifiers?

Q. What are escape sequence?

Q. Define clrscr( ) function.

Q. What is the purpose of getch( ) / getche( ) function?


CHAPTER NO. 12 (2nd Year)
Q. Define two uses/advantages of Loop.
Ans:
 loops are used to execute a statement or number of statements for specified number of
times.
 Loops are used to access a sequence of values.
Q. What is while loop / do-while loop / for loop.
Ans:

Q. What is the syntax of for loop / while loop / do-while loop


Ans:

Q. What is counter-controlled loop?


Ans: The counter-controlled loop depends on the value of a counter variable. The value of counter
variable is changed each time the body of loop is executed.
Example: for loop is called counter-controlled loop.
Q. What is sentinel-controlled loop?
Ans: The sentinel-controlled loop depends on special value known as sentinel value. The loop
terminates when sentinel value is reached.
Example: while loop and do-while loops are called sentinel-controlled loops.

Q. What is nested loop?


Ans: A loop within a loop is called nested loop. One loop is called inner loop and other loop is
called outer loop.
Q. What is nested loop?
Ans: A loop within a loop is called nested loop. One loop is called inner loop and other loop is
called outer loop.

Q. Define infinite loop?


Ans: A loop in which ending condition never occurs is called infinite loop. It repeats forever until
user himself stops the loop.

Q. Define break statement?


Ans: A break statement is used to exit from the body of a loop.
Sytax. break

Q. Define continue statement?


Ans: The continue statement is used in the body of loop. It is used to move the control to the start
of the loop body.
Example: continue

Q. What is the use of goto statement?


Ans: goto statement is used to transfer the control from one statement to another statement in a
program without any condition. The control is transferred to a named label.
Syntax: goto label;
…………
…………
label: statement;
Chapter 14 (2nd Year)
Q: Define a stream?
Ans: A logical interface to a file is known as stream. A stream is associated with a file using open
operation. The stream is disassociated from file by using a close operation.

Q: What do you mean by text stream?


Ans: A text stream is a sequence of characters. A certain character translation may occur in a
text stream. For example, a new line may be converted to a carriage return / line feed pair.

Q: What is binary stream?


Ans: A binary stream is a sequence of bytes. The translation is not performed in binary stream.
It exists with a one-one correspondence to the external devices.

Q: How is the end of text file indicated?


Ans: 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: What is a string?
A collection of characters written in double quotation is called string. Character variable are used
to store a string. The length of string given in brackets in declaration statement such as char
book [20];

Q: What is meant by fgets ( ) function?


Ans: Data can be read form text file one character at a time by using fgetc function. Its syntax is
as follows:

ch = fgetc (File _ Pointer);

Q: How is a file closed?


Ans: An opened file is closed by using the fclose ( ) function. The syntaxof this function is fclose
(file _ pointer) where file _ pointer is the file pointer that refers to the file to be closed.

Q: Describe the purpose of file handing?


Ans: The purpose of file handing is to perform different operation on the files. It includes
opening, closing and saving the files. It also includes writing and reading from the files.

You might also like