1. Home
  2. Docs
  3. Model Question solution(S...
  4. Computer Science
  5. Model Questions and Solution(VII)

Model Questions and Solution(VII)

Ans: A network protocol is a set of rules and conventions that determine how data is transmitted and received over a network.

Ans: Antivirus software is a program designed to detect, prevent, and remove malware from computers and networks.

Ans: The default size of a text field in MS Access is 255 characters.

Ans: The data type used to store a photo in MS Access is OLE Object or Attachment.

Ans: Looping is a programming construct that repeats a sequence of instructions until a specific condition is met.

Ans: Two features of C language are its simplicity and efficiency, and its support for low-level memory manipulation.

Ans: Cyberlaw.

Ans: Qubit.

a. UTP: Unshielded Twisted Pair.

b. IoT: Internet of Things.

Ans:

Advantages: Facilitates resource sharing and enables communication between devices.

Disadvantages: Increases security risks and can lead to network congestion.

Ans: Computer ethics is the study of moral principles and guidelines governing the use of computers and technology.

Two ethics: Respect privacy and avoid unauthorized access to other people’s data.

Ans: Computer security refers to the protection of computer systems and information from harm, theft, and unauthorized use.

Two hardware security measures: Use of biometric authentication and hardware firewalls.

Ans:

E-commerce: Transactions are conducted online and accessible 24/7.

Traditional commerce: Transactions are conducted in physical locations with limited operating hours.

Ans: AI (Artificial Intelligence) is the simulation of human intelligence in machines designed to think and learn.

Two uses: Autonomous vehicles and personalized recommendations in e-commerce.

Ans: RDBMS (Relational Database Management System) is a database management system based on the relational model.

Two examples: MySQL and Oracle Database.

Ans: A report in MS Access is a formatted printout or display of data from a database.

Importance: Reports allow for the organized presentation and analysis of data, making it easier to understand and share insights.

Ans: Data sorting is the process of arranging data in a specific order, typically ascending or descending.

Two advantages: Facilitates quicker data retrieval and improves readability and analysis.

Screenshot 2024 05 23 063935

Field Names:

  1. symbol no.
  2. name
  3. Marks

Records:

  1. Record 1:
    • symbol no.: 001009010
    • name: Hari Thapa
    • Marks: 85
  2. Record 2:
    • symbol no.: 0010090
    • name: Binu Sharma
    • Marks: 91
DECLARE SUB ABC(A)
CLS
A=2
CALL ABC(A)
END
SUB ABC
FOR J=1 TO 5
PRINT A;
A=A+3;
NEXT J 
END SUB

Ans:

Dry Run:

StepJA (Initial)A (Updated)Output
11252
22585
338118
44111411
55141714

Output:

2 5 8 11 14
DECLARE SUB Series()
CLS
EXECUTE Series
END
SUB Series()
REM Program to generate 1 1 2 3 5 ..... upto the 20th terms
A=1
B=1
FOR ctr= 10 to 1
DISPLAY A:B:
A=A+B
B=A+B
NEXT ctr
END Series()

Ans: Corrected Program:

DECLARE SUB Series()
CLS
CALL Series
END

SUB Series()
REM Program to generate 1 1 2 3 5 ..... up to the 20th term
A = 1
B = 1
FOR ctr = 1 TO 20
  PRINT A;
  C = A + B
  A = B
  B = C
NEXT ctr
END SUB
OPEN "Detail.dat" FOR INPUT AS #1
OPEN "Temp.dat" FOR OUTPUT AS #2
INPUT "Enter name of the students"; S$
FOR I= 1 TO 10
INPUT #1, Nm$, C1, A
IF S$<>Nm$ THEN
WRITE #2, Nm$, C1, A
END IF 
NEXT I
CLOSE #1, #2
KILL "Detail.dat"
NAME "Temp.dat"AS "Detail.dat"
END

Ans: The main objective of the program is to remove the record of a student with a specified name from the file Detail.dat and save the updated records in a new file, which then replaces the original file.

Ans: Yes, if the “KILL” statement is removed, the original Detail.dat file will not be deleted. This will cause a conflict when trying to rename Temp.dat to Detail.dat, as the original Detail.dat still exists. The program will not be able to overwrite the original file, and the update will fail.

Screenshot 2024 05 23 070434

Ans:

i. (11111101)2 to (?)16

First, group the binary number into sets of four digits, starting from the right: (1111)(1101)

Next, convert each group to its hexadecimal equivalent:

  • (1111)2=F16​
  • (1101)2=D16​

So, (11111101)2=(FD)16​.

ii. (245)10 to (?)2

Divide the number by 2 and record the remainders:

245÷2=122 remainder 1

122÷2=61 remainder 0

61÷2=30 remainder 1

30÷2=15 remainder 0

15÷2=7 remainder 1

7÷2=3 remainder 1

3÷2=1 remainder 1

1÷2=0 

Reading the remainders from bottom to top, (245)10=(11110101)2

iii. (1010)2×(101)2=(?)2

First, convert both numbers to decimal:

  • (1010)2=1â‹…2^3+0â‹…2^2+1â‹…2^1+0â‹…2^0=8+2=10
  • (101)2​=1â‹…2^2+0â‹…2^1+1â‹…2^0=4+1=5

Now, multiply the decimal numbers: 10×5=50

Convert 50 back to binary:

50÷2=25 remainder 0

25÷2=12 remainder 1

12÷2=6 remainder 0

6÷2=3 remainder 0

3÷2=1 remainder 1

1÷2=0 remainder 1

Reading the remainders from bottom to top, (50)10=(110010)2.

Thus, (1010)2×(101)2=(110010)2.

iv. (101110)2÷(110)2(101110)2​÷(110)2​

First, convert both numbers to decimal:

  • (101110)2=1â‹…2^5+0â‹…2^4+1â‹…2^3+1â‹…2^2+1â‹…2^1+0â‹…2^0=32+8+4+2=46
  • (110)2=1â‹…2^2+1â‹…2^1+0â‹…2^0=4+2=6

Now, divide the decimal numbers:

46÷6=7 remainder 4

Convert 7 and the remainder 4 back to binary:

(7)10=(111)2​

(4)10=(100)2​

Thus, (101110)2÷(110)2=(111)2 remainder (100)2.

Ans: QBASIC Program to Calculate Volume and Area:

DECLARE SUB CalculateVolume (length, breadth, height)
DECLARE FUNCTION CalculateWallArea (length, breadth, height)

DIM length, breadth, height AS SINGLE

INPUT "Enter the length of the room: ", length
INPUT "Enter the breadth of the room: ", breadth
INPUT "Enter the height of the room: ", height

CALL CalculateVolume(length, breadth, height)
PRINT "The area of the four walls is: "; CalculateWallArea(length, breadth, height)

SUB CalculateVolume (length, breadth, height)
    volume = length * breadth * height
    PRINT "The volume of the room is: "; volume
END SUB

FUNCTION CalculateWallArea (length, breadth, height)
    area = 2 * height * (length + breadth)
    CalculateWallArea = area
END FUNCTION

Ans: QBASIC program to display all the information of students whose marks in English are more than 40 from the sequential data file “Record.dat”:

OPEN "Record.dat" FOR INPUT AS #1

PRINT "Roll No.", "Name", "Gender", "English", "Nepali", "Math", "Computer"
PRINT "-------------------------------------------------------------"

DO WHILE NOT EOF(1)
    INPUT #1, RollNo, Name$, Gender$, English, Nepali, Math, Computer
    IF English > 40 THEN
        PRINT RollNo, Name$, Gender$, English, Nepali, Math, Computer
    END IF
LOOP

CLOSE #1

Ans: Here is the C program that asks a number and checks whether it is odd or even:

#include <stdio.h>

int main() {
    int number;
    printf("Enter a number: ");
    scanf("%d", &number);

    if (number % 2 == 0) {
        printf("%d is even.\n", number);
    } else {
        printf("%d is odd.\n", number);
    }

    return 0;
}

Ans: Here is the C program to display the Fibonacci series up to the 10th term:

#include <stdio.h>

int main() {
    int n = 10, t1 = 0, t2 = 1, nextTerm;

    printf("Fibonacci Series: ");
    for (int i = 1; i <= n; ++i) {
        if (i == 1) {
            printf("%d, ", t1);
            continue;
        }
        if (i == 2) {
            printf("%d, ", t2);
            continue;
        }
        nextTerm = t1 + t2;
        t1 = t2;
        t2 = nextTerm;

        printf("%d, ", nextTerm);
    }

    return 0;
}

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *