Friday, 24 January 2025

2081 MODEL SET 1 OF COMPUTER SCIENCE

 Solved by Milan Baral                                                          


SEE COMPUTER MODEL SET 1


Group "A" 

Answer the following questions in one sentence                                                                        [6X1=6]                                                                            2081-10-11

1. Answer the following questions in one sentence:

a. What is internet?

The internet is a global network of interconnected computers that allows sharing of information and communication.

b. What is cloud computing?

Cloud computing is the delivery of computing services like storage, servers, and databases over the internet.

c. What is the extension of MS Access?

The extension of MS Access is .accdb or .mdb.

d. Which data type is used to store salary of an employee in MS Access?

The currency data type is used to store the salary of an employee.

e. Write the function of EOF.

EOF (End of File) checks whether the end of a file has been reached during file processing.

f. Why is C called a middle level language?

C is called a middle level language because it combines the features of both high-level and low level programming languages.

 2. Write down the single technical term for the following:

a. A method of transmission that uses radio waves to transmit information instead of cable.

Wireless communication.

b. The digital information about a particular person that exists on the internet as a result of their online activity.

Digital footprint.

 3. Write the full forms for the following:

a. ATM: Automated Teller Machine.

b. BIT: Binary Digit.

 GROUP "B"

Answer the following questions:                                                                    [9X2=18]

1. Answer the following questions:

a. What is LAN topology? Write any two advantages of star topology over bus topology.

LAN topology refers to the arrangement of devices and connections in a local area network (LAN). It defines how devices are interconnected and how data is transmitted within the network.

Advantages of star topology over bus topology:

i. Easier to troubleshoot.

ii. Failure of one device does not affect the entire network.

b. Define digital footprint and digital citizenship.

Digital footprint is the trail of data left by users while using digital devices and the internet.

Digital citizenship is the responsible use of technology to engage positively and ethically in the digital world.

c. What is cryptography? Explain encryption.

Cryptography is the practice of securing communication by converting information into a coded format.

Encryption is the process of converting plaintext into cipher text to prevent unauthorized access.

d. Mention any two threats and two opportunities of using social media.

Threats: Cyberbullying, Privacy breaches.

Opportunities: Networking, Promoting businesses.

e. Write any two benefits and two limitations of mcommerce.

Benefits: Convenience, Wide reach.

Limitations: Security concerns, Limited access in remote areas.

f. Define field and record with examples.

A field is a single piece of data in a database, such as "Name," "Age," or "Email."

Record is a collection of related fields that represent a single entity in a database, such as a student's name, age, and grade.

g. What is the primary key? Why is it important?

The primary key is a unique identifier for records in a database table.it is important as it ensures data integrity and prevents duplicate entries. It also helps in establishing relationships between tables and speeds up data retrieval. It ensures data integrity and prevents duplicate entries

h. What is form? write its uses

A form is a user-friendly interface for entering and viewing data in a database.

Its Uses are

1.      Simplifies data entry, improves accuracy, and allows for easier data management.

2.      Forms can also enforce data validation rules to ensure the correctness of the entered data.

i. Define indexing and filtering.

Indexing is a technique to speed up data retrieval from a database. Filtering is the process of displaying only specific records based on conditions.

 

5. Write the output of the program:

                                                                                                      DECLARE SUB DISPLAY (T$)                                                                   Dry run

  C             T$              MID$(T$, C, 1)  D$      Printed

 

   1      "COMPUTER"     "C"                 "C"         C          

  3      "COMPUTER"      "M"                 "M"       M          

  5      "COMPUTER"      "U"                 "U"        U          

  7      "COMPUTER"      "E"                 "E"         E          

   CLS

   T$ = "COMPUTER"

   CALL DISPLAY(T$)

   END

SUB DISPLAY (T$)

FOR C = 1 TO LEN(T$) STEP 2

DS = MID$(T$, C, 1)

PRINT DS;

NEXT C

END SUB

 The final output will be           C M U E

 

6. Rewrite the program after correcting the bugs.

DECLARE SUB SERIES ()

CLS

EXECUTE SERIES

END

SUB SERIES

REM TO GENERATE 2 2 4 6 10 ………….. UP TO 10TH TERMS

P=2

Q=2

FOR CTR=1 TO 5

DISPLAY P,Q

P=P+Q

Q=P+Q

WEND

END SERIES()

After correcting the bug

DECLARE SUB SERIES()

CLS

CALL SERIES

END

SUB SERIES

REM TO GENERATE 2, 2, 4, 6, 10 ………….. UP TO 10TH TERMS

P = 2

Q = 2

FOR CTR = 1 TO 10

    PRINT P,Q

    P = P + Q

    Q = P + Q

NEXT CTR

END SUB

7. Analyze the program given below and answer the following question

DECLARE FUNCTION rev$ (NS$)

CLS

INPUT "Enter any string: "; NS$

PRINT "Reversed string: "; rev$(NS$)

END

 FUNCTION rev$ (NS$)

FOR X = LEN(NS$) TO 1 STEP -1

    RS$ = MID$(NS$, X, 1)

    S$ = S$ + RS$

NEXT X

rev$ = S$

END FUNCTION

 

A. List the library functions used in the above program:

  LEN (to find the length of the string) 

  MID$ (to extract individual characters from the string)

 B. What will be the maximum value of X if NS$ is equal to "COMPUTER"?

  The length of "COMPUTER" is 8. 

    Hence, the maximum value of X will be 8.

GROUP C (4X4=16)

8. Convert or calculate as instructed                           

i. (101101)2 into decimal

1X25+0X44+1X22+1X22+0X21+1X20

(45)10

ii. (75335)8 into Hexadecimal          

iii. 10110 X 1011 

iv. 1100101 by 100 

 9. a. Wap to display volume of cuboid using sub procedure and to find the TSA of cuboid using function procedure [ HINT Volume= LXBXH, TSAC=2(LB+BH+LH)

DECLARE SUB Volume(L, B, H)

DECLARE FUNCTION TSA(L, B, H)

CLS

INPUT "Enter Length, Breadth, Height: ", L, B, H

CALL Volume(L, B, H)

PRINT "The Total Surface Area (TSA) is: "; TSA(L, B, H)

END

SUB Volume(L, B, H)

    PRINT "The Volume is: "; L * B * H

END SUB

FUNCTION TSA(L, B, H)

    TSA = 2 * (L * B + B * H + L * H)

END FUNCTION

b. WAP to create a sequential file "Salary.dat" to store programmer's name, Salary and post according to the need of the user.

OPEN "Salary.dat" FOR OUTPUT AS #1

DO

    INPUT "Enter programmer's name: ", name$

    INPUT "Enter salary: ", salary

    INPUT "Enter post: ", post$

    WRITE #1, name$, salary, post$

    INPUT "Do you want to enter more data? (Y/N): ", choice$

LOOP WHILE UCASE$(choice$) = "Y"

CLOSE #1

c. Write a C program to ask any three numbers from user and display the middle number among three numbers.

#include <stdio.h>

int main() {

    int a, b, c;

    printf("Enter three numbers: ");

    scanf("%d %d %d", &a, &b, &c);

    if (a >= b && a <= c || a <= b && a >= c) {

        printf("Middle number: %d\n", a);

    } else if (b >= a && b <= c || b <= a && b >= c) {

        printf("Middle number: %d\n", b);

    } else {

        printf("Middle number: %d\n", c);

    }

    return 0;

}

Or

Write a C program to display the following series:

2, 3,5,7,11,13,17……………. Up to 10th temrs

include <stdio.h>

int main() {

    int count = 0, num = 2;

    while (count < 10) {

        int prime = 1;

        for (int i = 2; i * i <= num; i++) {

            if (num % i == 0) {

                prime = 0;

            }

        }

        if (prime) {

            printf("%d ", num);

            count++;

        }

        num++;

    }

    return 0;

}                                                                                                  

   सफलता को सुभकामना

 Milan Baral 




SEE IMP QUESTIONS C LANGUAGE

  Write a C program to calculate simple interest . The program should accept the principal amount , rate of interest , and time period as ...