0% found this document useful (0 votes)
47 views43 pages

Computer Science 12th

Uploaded by

anshu26st
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)
47 views43 pages

Computer Science 12th

Uploaded by

anshu26st
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/ 43

1

NIOS CLASS 12TH COMPUTER SCIENCE - (330)

Written by Manish Verma


Solved Previous Year Question Paper in English
Medium

I want to help you all in every way because


We can contribute in any way in the
development of the country which will be a
True tribute to the brave heroes and it will be a
My first priority to take the country to a new
Height for which I have tried to convert some
Of my ideas from social media and from my
educational academy into basalis in which the
safety of women, the education of daughters, is
the cause of terror from the country. Protection
of spirit and environment should be our first
priority! Hope you all get full support in this.

➢ Subscribe to our channel:-Click here


➢ Nios Official Channel :- Click here
➢ Paid Notes:-Click here
➢ Free Notes:-Click here
➢ Call &Whatsapp Support: 8368259468

©THE COPYRIGHT ACT 1957.


All rights reserved. No part of this publication may be reproduced,
Distributed, or transmitted in any form or by any means, including
Photocopying, recording, or other electronic or mechanical methods,
Without the prior written permission of the publisher, except in the case of brief quotations
embodied in critical reviews and certain other noncommercial uses permitted by copyright
Law

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


2

SOLVED PAPER – I

Q. 1. Answer the following question briefly.

(a) What are the two main characteristics of a Computer system?

Ans Two main characteristics of a computer system:-

1. Accuracy: Computer always give 100% rate result, it never give wrong result.

2. Speed: Processing speed of computer is very fast.

(b) Name two input and output devices.

Ans Two Input and output devices are:

1. Input Devices: Keyboard, Mouse.

2. Output Devices: Monitor, Printers.

(c) What is ‘My Computer'?

Ans. My Computer: My Computer is the entry point of your computer's folder structure
and resources. My computer is the most important Desktop item.

(d) Explain the term EDI?

Ans. EDI stands for Electronic Data Interchange. EDl refers to Computer to Computer
Exchange business document in a standard and agreed formed. EDI is the key to

paperless office. EDI has become major means of business communication among large
campaign in USA.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


3

(e) What is Automatic Memory Management?

Ans. Java is Automatic Memory Management.

(f) What is FTP? List at least two objectives of FTP?

Ans. FTP: FTP stands for File Transfer Protocol, is an internet utility software used to
upload and down load files.

List at Least two objectives of FTP.

1. Provide reliable transfer of data over the network.

2. Provides transfer statistics / diagnostics. .

Q. 2. Answer the following question.

(a) What are the five basic activities performed in data processing?

Ans. (i) Collection: Collection of data include following activities.

(a) Origination the data.

(b) Measuring the data.

(c) Recording the data.

(d) Comparing the data.

(ii) Conversion: Once the data is collected, it is converted from its sources documents

to a form that is more suitable for processing. Conversion of data includes the following
activities.

(a) Coding the data for further classification.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


4

(b) Classifying the data.

(c) Verifying the data.

(d) Transforming the data.

(iii) Manipulation: Once data is collector converted. It can be manipulated to obtain


the information. Manipulation of data includes the following activities.

(a) Sorting the data.

(b) Calculating the data.

(c) Summarizing the data.

(d) Comparing the data.

(iv) Storing the Data: It includes the following activities.

(a) Storing the data on a stored device for future use.

(b) Retrieving the data for finding the or information.

(v) Communicating the Data or Information: In this process data or information is


communicated to the appropriate department or person in the form of soft 'copy and

hard copy.

(b) List the two major function of operating system?

Ans. Major functions of operating system.

1. It establishes an interface between the computer hardware and the user.

2. It keeps track of users account to deny the unauthorized access of user.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


5

3. If assigns processors of different task being performed by the computer system.

4. It allocates main memory and other storage areas to the computer system programs
as well as users programs and data.

5. Manages input/output operations.

6. Interpred command and instructions given by the users.

7. It allows the other system program and user program to execute.

8. Establishes data security and integrity.

(c) Name the characteristics of Java programming language. Explain any one of
them?

Ans. Following are the salient features of Java.

(a) Java is simple and small.

(b) Java is object oriented.

(c) Java's complied code is profable.

(d) Java is architecture - neutral.

(e) Java is dynamic.

(f) Java has its own automatic memory management scheine.

(g) Java supports multi-threading.

(h) Java is robust.

(i) Java programs are secured.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


6

(j) Java's application can easily be distributed.

Explain:

1. Java Simple and Small: Java is simple because the Complicated Features of C++like
pointers, operator overloading and multiple inheritance are not included in Java. Thus it

is easy to learn program in Java. Java's component is small in size and complexity in
comparison to other development tools.

Q. 3. Answer the following question.

(a) What is topology? Name some common network topologies? Explain any of
them?

Ans. Topology: The geometric arrangement of computers in a network is known as

topology. Bus, Star and Ring are a few names of common topologies.

Name some common network topologies.

1. Bus Topology

2. Star Topology

3. Ring Topology

Explanation of one.

Star Topology: In star topology each node is connected to a central files server though
their independent and dedicated cable. The cables of all the nodes are connected to the

file server though hub. Hub is a device that serves as the central point where cable of all
the nodes is connected. Hub accumulates the information flow and then distributes

them to various groups and users.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


7

Star network is frequently used to connect one or more small computer or peripheral

devices to a large local computer or CPU. Star topology or its variation is used by much
organization in a time sharing system.

(b) Write a program using pointers to prints all the values of an integer array x
having four values as 10, 20, 30, and 40. 10, 20, 30, 40.

Ans.

# include <10 stream.h>

Void main ()

Into a [5], i;

For (i=1;i<5++)

a [i] -5 x 1:

For (i=0; i=4, I ++)

C out << a: [i];

Q. 4. Answer the following question,

(a) What is the purpose of size of operators in C++?

Ans. Size of ( ) operator is used to find the number of bytes, occupied by a variable or
constant in the memory

(b) What are literals? Name the various types of literals in C++?

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


8

Ans. Literal are such indentifies, whose value do not change during the execution of a

program, while literal or constant remains same at the time of program execution

Various types of Literals in C++ are:

(a) Integer Constants

(b) Character Constants

(c) Floating Constants

(d) String-Constants

(c) What is the function of logical operators in C++?

Ans. Logical Operators: Logical operators are used to combine two or more relational

expressions. There are three logical operators in C++ and they are,

(i) && AMD operator.

(ii) :: OR operator

(iii) ! Not operator.

(d)Assume the variable total starts with the value 10. What will be the output of

the following code?

(e) What is Modularity?

Ans. The act of partitioning a program into individual and independent modules or
components is called modularity.

(f) What is data encapsulation?

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


9

Ans. Data encapsulation also known as information hiding. It is the process of

combining both data and function that operates data, under a single unit and this unit is
called a class. The data of a class only be accessed by the function of the class. Soft is

not possible to access the data of a class directly. In this way data number of a class
become safe are considered far away from accidental alteration.

Q. 5. Answer the following question.

(a) What will be the value of variable x after the execution of the following
program?

Ans.

Void main ( )

int x;

int digit = 0;

x=1

While (digit = 10)

{++x

++ Digit :}

C out<<x;

Value of variable 12

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


10

(b) Explain the operation of 'if else statement in C++ with the help of a flow

diagram?

Ans. This is an extended form of simple if statement. Using this statement user can

explicitly define the statement to be executed if the condition is evaluated as false if


there are single statements to be executed in both true and false case they may be

written out enclosing in curly braces.

Format

If (Condition)

Statement l;

Else Statement 2;

e.g.

a = 25;

b = 15;

If (a >b)

C out<<" a is greater than b".

Else

Cout << "b is greater than a";

In the above example, if the condition is true then the statement written after eise will

be executed.

(c) What is Token? List its various types?

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


11

Ans. Token: A Token is a group of character that conveys some meaning to the

compiler when presented in a lien of program. C++ uses following types to token.

(i) Keywords

(ii) Identifiers

(iii) Literals

(iv) Punctuators

(v) Operators

(d) What is Polymorphism? How is it implemented in C++?

Ans. Polymorphism: Polymorphism is a concept oop, which employs that operations

may behave ferently on different class. The behavior depends on the types of data used
in the operation. For example the Operator may have a polymorphic behavior. It

Produce a sum of given two numbers whereas if the operands are strings them it will
produce a third ting by concatenating them.

(e) Find the errors if any in the following program code?

#include <10 stream.h>

Void main ()

{Int x;

Cin >> x;

For (int y = 0, y < 10, y++);

C out >> X+y:}

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


12

Errors: 6 - Multiple declarations for ‘y’.

6 - Declaration syntax error

7 - Illegal structure operation

8 - Expreation syntax

8 - for statement missing}

8 - Compound statement missing}

8 - 'Y' is assigned a value that is never used.

Q. 6 (a): Identity the header file (s) for the following built in functions:

Ans. Put Char (): This function is used to display the inputted character on the screen.
This function too is available in stdio.h header files. .

For example.

#include <10 steam.h>

#include <stdio-h>

Void main ()

Char x;

X = get char ()

Put char (X)

(b) Distinguish between local and global variables.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


13

Ans. The variables which are declared within the body of a function are called local

variables. A local variable has a local scope, i.e., it can be used only in that function in
which it is declared. The portion of the program in which a variable is retained in the

memory is known as scope of a variable. A variable may be local to a function or a


compound statement.

The variables which are declared outside any function are known as global variable. A
global variable can be used any function. Generally global variable are declared at the

top of the program i.e. before function definition. .

(c) Write a structure specification for the "student' having variables:

Roll no, Name, class and Date of Birth

Struet student

Char name [20];

Int cls, roll no, D.O.B

Q. 7. Write a program that will accept a 1 character grade code and depending on
this grade code the employee is display as per the following table.

Grade Code Pay A

A. 50,000

B. 30,000

C. 0,000

# include <10 stream.h>

# include <ctye.h>
All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/
14

Void main ()

char ch;

Cout << "/h Enter a character for greade;":

Ch = get ch; switch (ch)

Case A':

Cout<<"Salary is 50,000";

break;

Case 'B';

Cout << "Salary is 30,000";

Break;

Case 'C'

Cout << "Salary is 10,000";

Break;

Default:

Cout << "Invalid grade",

Q. 8. Answer the following questions:

(a) List the Features of enumerated data types.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


15

Ans. An enumerated data type is that which can hold a finite list of value that a data

type can take. An enumerated variable is declared by using enum key board for
example, errúm month {Jan, Feb, March, April} enum days [Sun, Mon,Tue, Wed, Fri]

Q. 9. (b) What is a class?

Ans. Class: A class is an abstraction the describes the properties important to an


application and ignores the rest. Each object is said to be an instance of its class. Once a

class has been defined, we can create any number of objects associated with the class.

(c) What is an object? How can it be created?

Ans. Object: An entity that has some characteristics is called an object In real world an

object simply exists, but with in a programming language each object has a unique
handle by which it can be uniquely referenced. In real world a book, a copy, a pen, a bus,

a car, etc. are object but in a programming language a window, a button, a scroll bar
etc. are object which are; of their relevant class. In programming world interact by

sending message to one another and interact without having to know the details other's
data or code.

(d) What is Abstract class?

Ans. Abstract Class: An abstract class that be used to create objects. An abstract class
acts a class and can be inherited by other class’s derived class.

(e) What are the different forms of inheritance?

Ans. Lateritance: Inheritance is a feat object-oriented programming that enables the

sharing of attributes and operation among classes based on hierarchical relationship. By


implementing the concept a new class can in all the features of existing class. The class

from which a new class: A from the inherited feature, a new class may contain i own
All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/
16

features too. In this way every class contain the features of both the classes. Inheritance

allows. Existing classes to be adapted to new application without the need for
modification.

(f) What is a derived class?

Ans. By specifying the relationship of derived class with the base using the visibility
mode, we can define a derived class. The new class is called derived class.

Q. 10. Answer the following questions.

(a) Name two ways in which a file can be opened in C++.

Ans. (1) Using the Constructer (Function) of a class,

(ii) Using the member Function () of the class.

(b) What is the difference between X [2] and IX + 2]

Ans. X [2) - Arya *(X+2) - Pointer

(c) Name the input and output pointers used in the file operations.

Ans. Input pointers used in a file operation is write ()

Output pointers used in file operation is read ().

(d) Explain the file mode parameters:

(1) Ios:: app : The ios :: app mode allow only addition of record at the end of life.

(i) Ios:: ate: The ios : ate mode allow addition and modification of record anywhere in

the fire.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


17

(e) Define a 2 dimensional array X having 2 raws and 6 columnist of the int data

type.

Ans. int X (2) [6]

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


18

Solved paper II

Q 1. Answer the following questions briefly:

(a) What is a bar code reader?

(b) What do you mean by 3D Audio?

(c)What is data processing cycle?

(d) How is data arranged according to hierarchical approach to data organization?

(e) Name the basic mouse actions.

Ans. (a) A bar code reader is a photoelectric Scanner that reads the bars of varying
thickness and convert them into electrical pulses to be processed by a computer.

(b) 3D Audio is a technology that enables a computer system to position sounds all

around a listener. We use the term 3D Audio to describe a much more sophisticated
system that can ideally position sounds anywhere around a listener.

(c) Data processing cycle is a continuous series 3. Four events: inputting of data,
processing of data, generation of output and storing of data.

(d) In hierarchical approach data is organized in this fashion

Data items → Record → File → Database.

(e). Clicking, Dragging and pointing.

Q.2. Answer the following:

(a) What are procedural-oriented languages?

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


19

(b) What is an operating system?

(c) What are the basic elements of a communication system?

(d) What do you mean by the term “bandwidth'?

Ans. (a) Procedure-oriented languages are high level-programming languages that


require each step to be specified in order to solve a problem. The procedural approach

towards programming enables the programmer to divide the complexity of a problem


into smaller parts called modules. Thus it makes the program easy to code and
implement.

(b) An operating system is system software that manages the hardware resources of a

computer system and establishes an interface between hardware and user to enable
his/her to work with computer.

(c) The basic elements of a communication system are:

❖ Sender that creates the message to be sent or transmitted.

❖ The transmission media that carries the message.


❖ The receiver that receives the message.

(d) Bandwidth refers to the range of frequencies that is available for transmission of data

on a communication channel. The wide the bandwidth of a communication channel, the


more data it can transmit in a given period of data. It is expressed in KBPS (kilobytes per

second).

3. (a) Name the various ways of getting connected to the Internet. What do we need for

a dial-up Internet account?

(b) Contrast between Java and C++.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


20

(c) Contrast between Simplex, Half Duplex and Full Duplex.

Ans. (a)

* Gateway access

* Dial-up connection

* Shell connections

* TCP/IP connection

* Leased connection.

For a dial-up Internet account we need

* a Shell or TCP/IP account from the ISPC (Internet Service Provider)

* a computer.

* a MODEM

* a telephone connection

* an Internet Browser such as Internet Explorer,

(b) No doubt, Java is derived from C and C++; but its features are less complicated than
C And C++. For example, Java does not support pointers, which is confusing and rarely

used feature of C and C++. Instead of pointers, Java supports tightly bounded array that

criminates the possibility of over writing memory and corrupting data unwillingly.

C and C++ supports structure and enums, while Java does not uses automatic

garbage collector to allocate and dellocate (free) memory for objects on as and when
required basis.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


21

In C++, programmers need to specify the allocation and deallocation of memory for

variables and objects.

Java does not support multiple inheritance whose smantic and usage has been

controvert sial in other languages; while C++ supports multiple inheritance.

Java compiler produces Bytecode that can be run on any machine on which JVMC Java
Virtual Machine) has been installed: while C++ compiler produces executable codes that

may not run on different machine architecture.

(c) All are data transmission modes. In simple mode of transmission, data can be
transmitted only in one direction. FM radio uses this mode of communication. In Half-

Duplex mode data can be transmitted in both directions over the communication
channel, but only in one direction of a time. In full-Duplex mode data can be

transmitted in both directions over the communication channel at the same time.
Telephone lines use this mode of communication.

4. (a)- What are the basic data types in C++?

(b) What are Identifiers?

(c) What is the function of punctuator character braces '{in C++?

(d). Assume the variable sum starts with the value 26. What will be the output of
the following code?

cout << sum --;

cout << ++ sum;

(e) What is Polymorphism?

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


22

(f) What is Data Abstraction?

(g) What is Inheritance?

Ans. (a) the basic data type C in are:

• int (Integer data type)


• float (Floating point data type)

• char (Character data type)

(b) An identifier is a symbolic name consisting of characters belongs to C++ character

set. An indemnifier is used to store a value in a memory location.

(c) The punctuator character braces '( )' in C++ is used to indicate a block of code in a
program for compiler. Opening brace'(‘indicates beginning and closing brace--

')'indicates end or block.

(d) 21

Because, in the statement:

cout << sum --;

the value of sum will be not decreased by one (at first occurrence as it uses post

decrement on erator i.e. --'

(e) Polymorphism is derived from two Latin words. Poly and Morphos. Poly means many
and Morphos means forms. Thus Polymorphism is feature that allows one interface to

be used in multiple actions or methods.

(f) Abstraction is the act of representing essential features of an object without including

of knowing the background details of object. All the object oriented programming

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


23

languages provide data abstraction capability.

(g) Inheritance is a process by which one object entity acquires the properties/features
of another object/entity. The concept of Inheritance is applied in all objects oriented

languages to derive (create) a new class from an existing class. The class from which a
new class is created/derived is called basa class and the class which is created/derived

from the base class is called a derived class.

Q.5. (a) what is a Null Statement? When is it useful?

(b) Explain the operation of do-while loop in C++ with the help of a flow diagram.

(c) Explain the ordering of data types in C++.

(d) Find the errors in the following program code:

#include <iostream.h>

main () } { int x, sum = 1;

X=1

while (x < 10)

{sum = X+;

x++;}

Cout<<"Sum of first ten numbers is =" << sum;

Ans. (a) When a line in the program contains only a semicolon character ( ; ), it is called

a null or empty statement. Null statement is quite useful when the syntax of the
language needs to specify a statement but the logic of that does not need any

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


24

statement A Null statement is generally used in for and while loon statement

(b) Syntax of do-while loop statement:

Do

Statement 1;

Statement 2;

Statement n :}

} While (condition)

In do-while loop the statements written on do and while are executed first and then the
condition is tested. If the condition evaluates to TRUE the body of the loop (statements

written within do and while) executes again. The condition is tested for each execution
of the body of the loop. The body of loop executes continuously, until the condition

does not evaluate to FALSE. Thus the body of loop at least executes once in do-while
loop.

(c) The order of precedence from highest to lowest for all the operators available in C++
is given below:

Category Operators

Post increment decrement ++, --

Pre-increment /decre- ++,--, size of ( )

ment, size of (), UNARY ,-,+

Multiplicative *,/,%

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


25

Additive +,-

Relational <,>,<=,.=

Equality ==,!=

Conditional AND $$

Conditional OR II

II

Ternary (conditional) ?:

Assignment =

Comma operator ,

(d) The main function is empty, and invalid; because of function must, be defined with a

opening parenthesis-'C' and a closing parenthesis - )'. If it is defined with 'O' then it
becomes valid, but an empty function, because its body contains no statement. The

second error in the program is that the statement is x= 1.

Is not ended with a semicolon character ';'. Thus the correct program will be:

#include <iostream.h>

Imain ():

int x, sum = 1

X= 1 while (* <= 10)

Sum = X+;

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


26

X ++;

Cout<<"sum of first ten numbers is == "<< sum;

Q.6.Name the header files to which the following functions belongs:

(i) Getchar ( )

(ii) Getchar ()

(iii) Exp ()

(iv) Strepy ()

(b) Distinguish between Local and Global variables.

(c) What is Function Overloading?

Ans.

(i) Stdio.h.

(ii) Conio.h

(iii) Math.h

(iv) String.h

(b) A Local variable is that which is declared inside the block of a function or compound
statement whereas a Global variable is de cleared before the main () function. The scope

of Local variable is over when the control goes out of the block in which it was created
whereas the scope of a Global variable is over only when execution of the program is

terminated
All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/
27

(c) Function overloading is a concept that implements polymorphism in C++. Function

overloading is a concept in which functions having the same name perform different
tasks.

Q.7.Write a program in C++ to search the presence of a value "data' in a sorted


array of N= 100 elements in ascending order using Binary Search method.

Ans.

#include <iostream.h>

Const int N= 100;

Void main ()

Char DT [100] [20];

Int initial mid, final;

Cout << "in Enter data in ascending order”;

For (int i = 0; is 'N;i++)

Cout << "Enter Data" cin >> DT[i]

Initial = 0;

Final = N-1:

Mid = (initial + final)/2

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


28

While (initial < = final) $ $ (DT (mid] == “Data"

if (DT (mid] > “Data")

final = mid - 1;

else

initial = mid + 1;

if (DT (mid == "Data")

cout << "Data found";

if (initial > final)

cout << "Data not found";

3. Answer the following:

(a) What is nesting of structures?

(b) Write the general format of typedef statement stating its purpose.

(c) What is the syntax for accessing data members of a structure?

(d) Identify the errors in the following program code:

#include <stdio.h>

Enum months {Jan, Feb, mar, apr, may, June);

Void main ()

{
All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/
29

Month’s dl, d2;

d1 = = 'jan';

d2 == 'may';

Int diff = may - Jan;

Cout << "Months between" <<d

If (d1 > d2) cout << "d2 comes before d1";.

Ans. (a) When a structure is used within another structure, it is called nesting of

structure.

(b) The general format of typedef statement:

Typedef existing-data-type new-data-type;

For example, typedef float decimal;

The typedef keyword is used to define a new data type for an exising data type. The
new defined data type is also known as user defined data type. This provides an

alternative name for standard data type.

(c) The syntax for accessing data members of structure is:

Structure-variable data member

Here, dot (.) is called 'member operator' which accesses the value of specified data
member. (d) There is a similar error in lines 6 and 7, because equality checking operator

i.e.,“==" have been used without if statement. So instead of equality operator,


assignment operators i.e.," =” must be used.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


30

Q.9. (a) State whether the statements given below are True (T) or False (F):

(i) A constructor is a special member function whose name is the same as class
name.

(ii) A member function cannot be called inside another member function of same

class.

(iii) A constructor cannot be declared with default arguments.

(b) Fill in the blanks:

(i) The feature that new class can use some of the properties of old class is known

as……………….

(ii) A class that is not used to create objects is called..........

(iii) The data in ……... section of the base class cannot be inherited.

Ans. (a) (i) T (ii) F (iii) F.

(b) (i) Inheritance, (ii) Abstract, (iii) Private

Q.10. Write a program using pointers to print all the values of an integer array X
having four values as 20, 25, 30, 40.

Ans. #include <iostream.h>

Voidmain ():

Int x [5] = {20, 25, 30, 40}

For (int i = 0; i < 4; i++)

Cout << "\n" << * (A + i);


All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/
31

Q.11. (a) If both input stream and output stream are used in the same program,

then which header file is required?

(b) Name the two inputs and output pointer used in file operations.

(c) Explain the file mode parameters:

(i) ios :: ate

(ii) ios:: nocreate

(d) Define a two-dimensional array twoD having two rows and six columns of the
int data type.

Ans.

(a) isotream.h

(b) Two input and output pointers used in file operations are: gat and put.

(c) (I) ios:: ate is a file mode parameter that positions the file pointer at the end of file
and a lows modification of data anywhere in the file addition of data at the end of file.

(II) ios:: nocreate is a file mode parameter That opens a file, only if the file exists but
does not create a new one. If the file already exists, it opens the file; otherwise if fails to

open the file and error message is responded by it.

(d) int twoD [-2] [6];

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


32

Sample paper III

Q. 1.Answer the following questions briefly

(a) Distinguish between OCR and OMR

Ans. OCR stands for optical character reader that can read text and number from the
paper and translate them into computer understandable form, OMR stands for optical

mark reader which can sense the presence or absence of a mark, such as pencil mark.

(b) List one feature of Control Panel in Windows 98.

Ans. Add/Remove program is one of the features of Control Panel that enable you

install a program such as MS-Word on your computer. You can also remove an installed
program from your computer by using this feature.

(c) What are Application Generators?

Ans. Application generator is a software system consists of a number of modules from


which the system selects an appropriate module as stated by the user in order to

perform a specific task.

(d) Distinguish between Logical and Physical records.

Ans. A logical record contains all the data related to a single entity, whereas a physical
record refers to a record whose data fields are stored physically next to one another.

(e) List the basic types of networks on the basis of geographical coverage.

Ans. On the basis of geographical coverage the basic types of networks are - LAN (Local
Area Network) and WAN (wide Area Network).

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


33

Q. 2. (a) Define System Software.

Ans. System software is a set of such instructions that directly interacts with computer
hardware and help the application software to excute (run).

(b) Define CD-ROM and WORM

Ans. CD-ROM is a compact disk, read-only in nature with very high storage density and

fast access time. WORM stands for Write Once Read Many, is a disk on which you can
write data permanently by using keyboard, video scanner, OCR equipments and other
devices.

(c) List the componenents of a data processing system. :

Ans.

(i) Input (data)

(ii) Processing (Machine and instructions or Man)

(iii) Output (Result or information)

(d) What is Electronic Commerce?

Ans. Electronic commerce popularity known as E-commerce is a paperless exchange of

business information using Electronic Data Interchange, Electronic mail, Electronic Fund

transfer and etc.

Q.3. (a) Define the term ‘Network Topology'.

Name commonly used network topologies?

Ans. Topology refers to the physically geometric arrangement of computers in a


network. Commonly used network topologies are –
All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/
34

(i) Star topology

(ii) Bus topology

(iii) Ring topology

(b) Explain the terms FTP and JVM.

Ans. FTP stands for File Transfer Protocol, is Internet utility software used to upload and

download files. JVM stands for Java Virtual Machine which is an interpreter that takes
the byte code of a Java program and convents it into the specific machine code for the

chip/processor on which it is installed.

(c) What are the important characteristics of Java language ?

Ans.

(i) Object oriented

(ii) Architecture-neutral

(ii) Portable

(iv) Dynamic

(v) Distributed

(vi) Robust

(vii) Secured

(viii) Multi-Threaded

(ix) Automatic Memory Management.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


35

4. (a) what are Tokens? Name various types of tokens in C++. Explain the function

of any one of these.

Ans. A token is a group of characters that logically belong together. Various types of

tokens in C++ are - keywords, identifiers, literals, punctuators and operators. For
example, int is a keyword of C++, which is a data type of C++, which occupies two bytes

in memory and can hold integer data/values from the range-32768 to 32767. 2)

(b) Arrange in the lowest to highest order of data types: long, char, float, and
double, int, long, double.

Ans. char, int, long, float, double, long double.

(c) Write an expression involving a logical operator that is true if limit is 45 and
speed is greater than 45.

Ans. int limit, speed; if ((limit==45)&& (speed > 45)

Q.5. what is OOP? What benefits does it offer to a programmer?

Ans. OOP stands for object oriented programming in an approach of programming to


meet the real word problem. It emphasizes on object model rather than logic of a

program for solving a problem

Benefits provided to a programmer by OOPs are:

(i) Reusability of code through inheritance

(ii) Develop a palomorphic behavior function that reacts differently on different instance
of objects.

(iii) Hides the functionality of an object from outside world.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


36

Q.6. (a) Name the Selection Control Structure ss. ment in C++. Write the syntax of

switch ment.

Ans. (i) If

(ii) If ....... then

(iii) If........ then else

(iv) Switch.... case switch (expression)

Case value 1: statements; break;

Case value 2: statements; break;

Case value n: statements; break;”

Default; statements;

(b) Write a while loop that displays the nu bers from 10 to 100.

Ans. int i = 10;

While (i <= 100)

Cout << '\" <<i;

i++;

(c) Write a program that will accept a character grade code and depending on

grade code, the salary is displayed accord to the following table:

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


37

Grade Salary:

A 20,000

B 15,000

C 10,000

Ans. #includes <iostream.h>.

#include < ctye.h>

Void main ():

Char ch;

Cout << "\n Enter a character for greade: “

Ch= getch ();

Switch (ch)

Case 'A': cout <<"salary is 20000";

Break; Case 'B':

Cout << "\n Salary is 15000";

Break;

Case ‘C’:

Cout <<"\n salary is 10000";

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


38

Break;

Default:

Cout << “Invalid grade “;

Q. 7. (a) Distinguish between local and global variables.

Ans. A local variable is that which is declared inside the block of a function or

compound statement where as a global variable is declared before the main () function.
The scope of local variable is over when the control goes out of the block in which it was

declared whereas the scope of a global variable is over only when the execution of
program is terminated,

(b) What will be the output of the following program?

// table.cpp

#includes <iostream.h>:

Void starline ();.

Void main ()

Starline ();

Cout << “Data type Range" << endl;

Starline (); cout << "char-128 to 127" << endl;

Cout << "int-32767" << endl; starline ();


All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/
39

// starline function definition

Void starline ()

For (int j =0; j<40 ++)

<< **.

Cout<<endl;

Ans.

****************************************************************************************

Data type Range

********************************************************************************************

Char-128 to 127

Int -32768 to 32768

********************************************************************************************

Q. 8. Do as directed:

(a) What is used to access the elements of an array?

Ans. The subscript or index number of an array is used to access the elements of an
array.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


40

(b) An array is a collection of elements of the same data types (Fill in the blank)

(c) The element A [7] is which element of the аттау?

Ans. 8th element.

(d) Write a statement that defines one-dimensional array called employees of type
int that can hold 10 data elements.

Ans. int employees [10];

(e) Define a two-dimensional array twoD having 3 rows and 4 columns and stores
int data type.

Ans. int two D [3] [4];

Q.9. (a) what is the function of typedef statement in C++?

Ans. The typedef statement is used to define a user defined data type from an existing
data type.

For example

Typed of decimal float;

Decimal salary;

(b) Write a structure specification that includes three variables -- all of types int-
called hrs, mins and secs. Call this structure time.

Ans. struck time

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


41

int hrs, mins, secs;

}:

Q.10. (a) what is a Constructor? How is it de cleared? Explain using an example.

Ans. A constructor is a special type of function which has the same name of a class in
which it is declared.

Class BOX Area

Float length;

Float width;

Int BOX Area (float, 1, float W)

………………...

…………………

......................

};

(b) Discuss the various forms of inheritance in C++.

Ans.(i) Single inheritance- In this form a single class derives the properties of a base

class. ...

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


42

(ii) Multiple inheritances - In this form a new class inherits properties of more than one

class.

(iii) Multilevel inheritance - In this form a derived class inherits the properties of another

de rived class.

(iv) Hierachical inheritance - In this form one class may be inherited by more than one
class.

(v) Hybrid inheritance – It is a combination of hierarchical and multiple inheritance.

(c) Write a statement that displays the address of the variable testvar.

Ans. Cout<<& tostvar;

(d) To declare age pointer to integer, what should we write?

Ans. int * age;.

(e) What is the difference between inparr (5) and * (inparr + 5]?

Ans. inparr [5] returns the value stored in the 6th element of inparr array, whereas *

(inparr + 5) return the value stored at inappr + 5), where inpaar is a pointer to array that
holds: · the address of inappr (O), that is, & inappr [0].

Q 11. What will the statements below perform?

If stream infile;

Infile. Open (“ABC”, ios:: ate);

Int B = infile.tellg ();

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/


43

Ans. The first statement: stream infile; will create an stream object called infile of type if

stream class.

The second statement:

Infile. Open ({ABC”, ios: ate); :.

Will call the open () member function of object infile, an instance of if stream class and

the open () function will open the ABC file in input/output mode and places the file
pointer at the end of file. The third and last statement.

Int B = infile. tellg ();

Will assign the size of file in B. aš telg () function will return the last byte position
number of the file.

All Rights reserved © Manish Verma : NIOS Channel, Visit https://manishvermaofficial.com/

You might also like