Computer Science Class 10: Practice Time

 Practice Time


1) Write a QBASIC program that allows the user to enter the radius and height. Create a user-defined function to calculate the area of the circle and a subroutine to calculate the volume of a cylinder. Hint: [A=Ï€r2, V=Ï€r2h]     4

Ans:

DECLARE FUNCTION area (r)

DECLARE SUB volume (r, h)

CLS

INPUT "Enter radius and height:"; r, h

PRINT "Area of circle:"; area(r)

CALL volume(r, h)

END

 FUNCTION area (r)

area = 22 / 7 * r ^ 2

END FUNCTION

 SUB volume (r, h)

v = 22 / 7 * r ^ 2 * h

PRINT "Volume of a cylinder:"; v

END SUB

2) Write a QBASIC program that reads from a sequential data file named 'Record.txt,' which stores data under the headings: Roll No., Name, Gender, English, Nepali, Math, and Computer. The program should display the information of all female students who have passed all subjects. [Note: A passing mark in all subjects is 35].  4

Ans:

CLS

OPEN "record.txt" FOR INPUT AS #1

DO WHILE NOT EOF(1)

INPUT #1, rn,name$,g$,eng,nep,math,comp

IF UCASE$(g$)="FEMALE" AND eng>=35 AND nep>=35 AND math>=35 AND comp>=35 THEN PRINT rn,name$,g$,eng,nep,math,comp

LOOP

CLOSE #1

END

3) Write any two keywords used in C-programming language.

Ans: Two keywords used in C-programming language are: int, return

4) What is the function of INT() in Qbasic programming?

Ans:In QBasic programming, the INT() function is used to return the integer part of a number by removing any fractional component.

5) What is computer network architecture? Mention its types.

Ans: Computer Network Architecture is defined as the physical and logical design of the software, hardware, protocols, and media of the transmission of data. 

Following are the different types of network architecture:

i) Peer-to-Peer network

ii) Client/server network

iii) Centralized network

5) What do you mean by digital signature? Why it is important?

Ans: A digital signature is a cryptographic technique that verifies the authenticity and integrity of a digital document or message.

The following are the importance of digital signatures:

i) Digital signatures confirm the identity of the sender, ensuring the recipient knows who created the document or message.

ii) It provides a high level of security for online transactions, protecting against fraud and unauthorized access.

 

6) What is a firewall? Enlist the types of firewalls.

Ans: A firewall can be defined as a special type of network security device or a software program that monitors and filters incoming and outgoing network traffic based on a defined set of security rules.

Following are the different types of firewall:

i) Packet-filtering firewalls

ii) Proxy Firewall

iii) Network Address Translation (NAT) firewalls.

 

7. Write the output of the given program. (workout with dry-run) 

DECLARE SUB show ()

CLS

CALL show

END

 

SUB show

c = 3

b = 2

FOR i = 2 TO 8 STEP 2

PRINT c;

SWAP b, c

b = c + 1

NEXT i

END SUB

Dry Run:



Variable c

Variable b

Loop check?

FOR I= 2 TO 8 STEP 2

Print c (Output)

C=3

B=2

 FOR I= 2 TO 8 ? Yes

3

C=2

B=3

B=2+1=3

FOR i=4 TO 8 ? Yes

2

C=3

B=2

B=3+1=4

FOR i= 6 TO 8? Yes

3

C=4

B=3

B=4+1=5

FOR i= 8 TO 8? Yes

4

C=5

B=4

FOR i= 10 TO 8? No

Exit from loop.

 

Final Output:

3 2 3 4

 8. Study the following program and answer the given questions.

DECLARE FUNCTION SUM(n)

CLS

INPUT "Enter a number";n

x=sum(n)

PRINT "The sum of individual digits is:";x

END

 FUNCTION sum(n)

WHILE n<>0

r= n MOD 10

s=s+r

n=INT(n/10)

WEND

sum=s

END FUNCTION

a) Name the user define function in above program.

Ans: sum

b) How many times the WHILE….WEND loop repeats, if the value of n is 1234?

Ans: 4 times

 9) Write a program in 'C' language to input number and check whether it is a palindrome or not.

#include<stdio.h>

int main()

{

                int n,r,t,a;

                printf("Enter any number:");

                scanf("%d",&n);

                a=n;

                while (n>0)

                {

                                r=n%10;

                                t=t*10+r;

                                n=n/10;

                }

                if(a==t)

                printf("number is palindrom");

                else

                printf("number is not palindorm");

                return 0;

}

 10)What is the Internet of Things? Write any two application of the area of virtual reality.

Ans: The Internet of Things (IoT) is a network of interconnected devices and objects that communicate and exchange data via the internet.

Following are the two application area of VR:applications

i. Gaming

ii. Education and Training

11) Define digital citizenship. Write any two examples of cyberbullying.

Ans: Digital citizenship refers to the responsible use of technology and the internet to participate in online communities and activities in a safe, respectful, and effective manner.

Following are the two examples of cyber bullying:

i. Sending threatening or harassing messages online.

ii. Spreading rumors or lies about someone on social media.

  12) What is information security? Write any four hardware security measures.

Ans: Information security is the process of protecting information and systems from unauthorized access or attacks in order to maintain their confidentiality, integrity, and availability.

Four hardware security measures are as here under:

i. Use power protection device (Volt guard, spike guard, UPS etc.)

ii. Regular maintenance

iii. Use firewall

iv. Insurance

13) WAP to calculate the area of a rectangle in c. [Hints: a = l x b]

#include<stdio.h>

int  main()

{

            int l, b, a;

            printf (“Enter Length: ”);

            scanf (“%d”, &l);

            printf (“Enter Breadth: “);

            scanf (“%d”, &b);

            a = l * b;

            printf (“The area is %d”, a);

            retirn 0;

}

14) WAP to calculate the average of 3 number in c. [Hints: av= (a+b+c)/3]

#include<stdio.h>

int main()

{

            float a, b, c, av;

            printf (“Enter 3 numbers: ”);

            scanf (“%f %f %f”, &a, &b, &rc);

            av= (a+b+c)/3;

            printf (“The average is %f”, av);

            return 0;

}

 15) Write a program to find greatest among two number

#include<stdio.h>

int main()

{

            int a,b;

            printf (“Enter two number”);

            scanf (“%d %d”, &a, &b);

            if (a>b)

            {

                        printf (“%d is greatest", a);

            }

            else

            {

                        printf (“%d is greatest", b);

            }

            return 0;

}

 

16) Write a program to find greatest among three number.

#include<stdio.h>

int main()

{

            int a, b, c;

            printf (“Enter 3 number”);

            scanf (“%d %d %d”, &a, &b, &c);

            if (a>b && a>c)

            {

                        printf (“%d is greatest", a);

            }

            else if (b>a && b>c)

            {

                        printf (“%d is greatest", b);

            }

            else

            {

                        printf (“%d is greatest", c);

            }

            return 0;

}

 

17) What is File Handling in QBasic?

Ans: File handling refers to the process of reading, writing, and manipulating data stored in files. In QBasic, files can be stored on a computer's hard drive, floppy disk, or any other storage device.

18) How to Open and Close a File in QBasic?

Ans: To open a file in QBasic, you need to use the OPEN statement, followed by the file name, access mode, and file number. For example: OPEN "file.txt" FOR INPUT AS #1 This statement opens the file "file.txt" in read-only mode with a file number of 1. To close the file, use the CLOSE statement as follows: CLOSE #1

 19) How to Read Data from a File in QBasic?

Ans: To read data from a file in QBasic, you need to use the INPUT statement, followed by the variable name and file number. For example: INPUT #1, x This statement reads the data from file number 1 and assigns it to the variable x. You can also read multiple values at once by separating them with commas: INPUT #1, x, y, z
20) How to Write Data to a File in QBasic?

Ans: To write data to a file in QBasic, you need to use the PRINT statement, followed by the data and file number. For example: PRINT #1, "Hello World!" This statement writes the string "Hello World!" to file number 1. You can also write multiple values at once by separating them with commas: PRINT #1, x, y, z
21) How to Append Data to a File in QBasic?

Ans: To append data to a file in QBasic, you need to use the APPEND statement, followed by the file name and file number. For example: OPEN "file.txt" FOR APPEND AS #1 This statement opens the file "file.txt" in append mode with a file number of 1. You can then write data to the file using the PRINT statement.

  22) Write the difference between program file and data file.

Ans: Following are the different between program file and data file.

Program file

Data file

 Programs files are associated with providing access and execution of an actual program that is stored and installed in the computer system.

 Data file contains data and information needed for program to perform execution successfully. Data files are linked with a program file during run time.

23)  How to Delete a File in QBasic?

To delete a file in QBasic, you need to use the KILL statement, followed by the file name. For example: KILL "file.txt" This statement deletes the file "file.txt" from the computer's storage device.

24)Define data communication. What are the components of data communication?

Ans: The collection of hardware, software and other devices that allows to exchange data, information and voice between two or more devices through a wire or radio waves is called data communication.

  The Components of data communication are as follows:

    - Data

    - Sender

    - Medium

    - Receiver

  - Protocol

25) Explain the different modes of data communication.

Ans:There are three main ways or modes for transmitting data from one device to another. They are: (i) Simplex Mode , (ii) Half-duplex Mode and (iii) Full-duplex Mode

  i. Simplex Mode : In this mode, transmission can take place in only one direction. It is called unidirectional transmission mode. The data or information is transmitted by only one device and other devices receive it. Television broadcast is an example of simplex mode of transmission. Other examples of simplex mode are TV broadcasting, Radio transmission, etc.

   ii. Half-duplex Mode : In this mode, data can be transmitted to both directions, but only to one direction at a time. It means half-duplex system can alternately send and receive data. Some suitable examples of half-duplex system are wireless, handset and walky-talky.

  iii. Full-duplex Mode: This mode allows simultaneous transmission of data to both directions. It allows both communicating devices to transmit and receive data simultaneously. A suitable example of full-duplex system is telephone system, where two people can communicate over a telephone. Both can talk as well as listen to each other at the same time in this system.

 26) Write any two differentiate between LAN and WAN.

LAN

WAN

i) It is controlled or owned by a single organization.

i) It is controlled or owned by multiple organizations.

ii) The diameter is not more than a few kilometers.

ii) It covers a larger geographical area.

iii) Example: Network within a Room

iii) Example: Internet

27) Define a computer network. Write any two advantages and disadvantages of it.

Ans: Two or more computers connected to each other to share data, hardware, software and other resources is called computer network.

 Two advantages of Computer Network:

i. Sharing of hardware and software resources

  ii. Communication becomes easy and cheaper.

 Two disadvantages of Computer Network:

 i. Failure of server stops application being available.

  ii. The system opens to hackers.


 Download Computer Science Class 10: Practice Time

For More Essential Very Short Q&As in Computer Science for SEE and 10th Grade Students:   Download Hare

Post a Comment

Post a Comment (0)

Previous Post Next Post