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

Model Questions and Solutions(VIII)

Ans: Google and Bing.

Ans: Social media refers to websites and applications that enable users to create, share content, and participate in social networking.

Ans: The SELECT query is used to view the data stored in a database.

Ans: Text and Number.

Ans: A function returns a value, whereas a sub procedure does not return a value.

Ans: Structured programming enhances code readability and maintainability, and it makes debugging and testing easier.

Ans: Cybercrime.

Ans: Antivirus software.

a. STP: Shielded Twisted Pair.

b. WAP: Wireless Application Protocol.

Ans: In Bus topology all devices share a single communication line or bus, which can lead to collisions whereas in star topology all devices are connected to a central hub, which reduces the risk of collisions and makes troubleshooting easier.

Ans: Computer crime is illegal activity that involves a computer or network.

Examples: Hacking, phishing, identity theft, and spreading malware.

Ans: Hardware security refers to the protection of physical devices from theft or damage.

Two measures of software security: Installing antivirus software and using firewalls.

Ans: E-Commerce is the buying and selling of goods and services over the internet.

Importance: It provides a global marketplace, reduces operational costs, and offers convenience for customers.

Ans: Mobile computing involves the use of portable computing devices, such as smartphones and tablets, to access and process information.

Importance: Enables access to data and applications anytime and anywhere, and enhances productivity through mobility.

Ans: A database is an organized collection of data (e.g., a library catalog)whereas a DBMS (Database Management System) is software that manages databases and allows users to create, read, update, and delete data (e.g., MySQL, Oracle).

Ans:

Ans: A primary key is a unique identifier for a record in a database table.

Two advantages: Ensures each record is unique and improves data retrieval speed.

Ans: A query is a request for data or information from a database.

Importance: Queries allow users to retrieve specific data, perform calculations, and generate reports based on the criteria set.

DECLARE SUB SHOW (A,B) 
CLS
X=1 : Y=2
CALL SHOW (X,Y) 
END 
SUB SHOW (A ,B) 
I=1
DO 
PRINT A;
A=A+B
B=A+B
I=I+1
LOOP WHILE I <= 5
END SUB

Ans:

Dry Run:

StepIA (Initial)B (Initial)A (Updated)B (Updated)Output
1112351
22358133
3381321348
442134558921
55558914423355

Output:

1 3 8 21 55
REM to store record in data file
CLS 
OPEN “info.dat” FOR INPUT AS #1 
DO
INPUT “Enter Name, address and class “; N$, A, C 
INPUT #1, N$, A, C
 INPUT “Do you want to continue “; Y$
WHILE UCASE$(Y$) = “Y” 
CLOSE “info.dat” 
END

Ans: Corrected Program:

REM to store record in data file
CLS
OPEN "info.dat" FOR OUTPUT AS #1
DO
  INPUT "Enter Name, address and class "; N$, A$, C$
  WRITE #1, N$, A$, C$
  INPUT "Do you want to continue (Y/N)"; Y$
LOOP WHILE UCASE$(Y$) = "Y"
CLOSE #1
END
DECLARE FUNCTION text$(N$)
CLS
INPUT “Enter any string”;X$
PRINT text$(X$)
END
FUNCTION text$(N$)
            FOR i=len (N$) TO 1 STEP -1
                        W$=W$+MID$(N$,I,1)
            NEXT i
            text$ = W$
END FUNCTION

Ans: The main objective of the program is to reverse the input string provided by the user.

Ans:

  • N$ (the string input to the text$ function)
  • I (the loop counter)
  • W$ (the string that accumulates the reversed characters)
  • X$ (the string input by the user)
  1. (1110001110)2 = (?)8
  2. (111)10 = (?) 2
  3. (1000) 2 – (111) 2 = (?) 2
  4. (111111) 2 ÷ (111) 2

Ans:

8. Convert / calculate as per the instruction: [4×1=4]

  1. ((1110001110)2 to ((?)8

Ans:
First, group the binary number into sets of three digits, starting from the right:
[ (001)(110)(001)(110) ]

Convert each group to its octal equivalent:

  • (001)2 =(1)8
  • (110)2 = (6)8
  • (001)2 = (1)8
  • (110)2 = (6)8

So, ((1110001110)2 = (1616)8

  1. ((111)_{10}) to ((?)_2)

Ans:

111÷2=55 remainder 1

55÷2=27 remainder 1

27÷2=13 remainder 1

13÷2=6 remainder 1

6÷2=3 remainder 0

3÷2=1 remainder 1

1÷2=0 remainder 1

Reading the remainders from bottom to top, ((111)10 = (1101111)2.

  1. ((1000)2 – (111)2 = (?)2

Ans:
First, align the numbers for subtraction:

1000
-0111
0001

So, ((1000)2 – (111)2 = (1)2.

  1. ((111111)2 / (111)2

Ans:
Convert both numbers to decimal:

  • (111111)2​=1⋅2^5+1⋅2^4+1⋅2^3+1⋅2^2+1⋅2^1+1⋅2^0=32+16+8+4+2+1=63
  • (111)2= 1⋅2^2+1⋅2^1+1⋅2^0=4+2+1=7

Now, divide the decimal numbers:
63÷7=9

Convert (9) back to binary:
(9)10 = (1001)2

So, ((111111)2 / (111)2 = (1001)2.

Ans: program in QBASIC to input radius of circle and calculate its area using function and circumference using sub procedure

DECLARE FUNCTION Area(R)
DECLARE SUB Circumference(R)

CLS
INPUT "Enter the radius of the circle: ", R

PRINT "Area of the circle: "; Area(R)
CALL Circumference(R)

END

FUNCTION Area(R)
  PI = 3.14159
  Area = PI * R * R
END FUNCTION

SUB Circumference(R)
  PI = 3.14159
  C = 2 * PI * R
  PRINT "Circumference of the circle: "; C
END SUB

Ans: Program to display all information of female students who pass in all subjects from “Record.txt”

CLS
OPEN "Record.txt" 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 Gender$ = "F" AND English >= 40 AND Nepali >= 40 AND Math >= 40 AND Computer >= 40 THEN
    PRINT RollNo, Name$, Gender$, English, Nepali, Math, Computer
  END IF
LOOP

CLOSE #1
END

Ans: program in C language to convert days into respective years, months and days.     

#include <stdio.h>

int main() {
    int days, years, months, remaining_days;
    
    printf("Enter the number of days: ");
    scanf("%d", &days);
    
    years = days / 365;
    remaining_days = days % 365;
    months = remaining_days / 30;
    remaining_days = remaining_days % 30;
    
    printf("%d days is equivalent to %d years, %d months, and %d days.\n", days, years, months, remaining_days);
    
    return 0;
}

Ans:

#include <stdio.h>

int main() {
    int num1, num2;
    
    printf("Enter the first number: ");
    scanf("%d", &num1);
    printf("Enter the second number: ");
    scanf("%d", &num2);
    
    if (num1 > num2) {
        printf("The greatest number is: %d\n", num1);
    } else if (num2 > num1) {
        printf("The greatest number is: %d\n", num2);
    } else {
        printf("Both numbers are equal.\n");
    }
    
    return 0;
}

How can we help?

Leave a Reply

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