Answers On/OffJS required
Group A
- Q1.Answer the following questions in one sentence.a. What is data communication?b. What is computer virus?c. Name any two types of datafile in QBasic.d. What is primary key?e. What is field?f. What is C language?A.Data communication is the process of transferring data between two or more devices through a transmission medium.A computer virus is a malicious program that replicates itself and harms computer data or system performance.The two types of data files in QBasic are sequential data file and random data file.A primary key is a field that uniquely identifies each record in a table.A field is a single piece of data or attribute within a record in a database.C language is a high-level, general-purpose programming language used for system and application software development.
- Q2.Write appropriate technical term.a. A network limited within a room or building.b. Commercial transaction through mobile devices.A.LAN (Local Area Network)M-commerce
- Q3.Write the full form of the following:a. UPSb. WWWA.Uninterruptible Power SupplyWorld Wide Web
Group B
- Q4.Answer the following questions.a. What is transmission media? Write its types.b. What is IoT? Write any two importance of it.c. Write any four opportunities and threats in social media.d. What is E-commerce? Write its types.e. What is information security? Write any two ways to protect our data.f. What is database? Write any two examples.g. What is table? Write the basic components of a table.h. What is action query? Write its type.i. Define input mask and validation rule.A.Transmission media are communication channels used to transfer data from one device to another.Its types are:• Guided media• Unguided mediaIoT (Internet of Things) is a network of interconnected devices that communicate and exchange data automatically.Any two importances of it are:• Increases automation• Improves efficiency and monitoringAny four opportunities of social media are:• Easy communication• Business promotion• Learning and information sharing• Online collaborationSimilarly, the threats of it are:• Cyberbullying• Data theft• Fake news• Privacy issuesE-commerce is the online buying and selling of goods and services.Its types:• B2B• B2C• C2C• C2BInformation security is the protection of data from unauthorized access, use, or modification.Ways to protect data are:• Use strong passwords• Install antivirus and firewallA database is an organized collection of related data.Examples:• MS Access• OracleA table is a database object used to store data in rows and columns.Basic components:• Field• RecordAn action query is a query that performs actions such as updating or deleting data.Its types are:• Update query• Delete query• Make-table query• Append queryInput mask is a predefined pattern to control the format of data entry.A validation rule is a condition that ensures only valid data is entered.
- Q5.Write down the output with dry run table.DECLARE SUB SERIES()CLSCALL SERIESENDSUB SERIESA=4B=5PRINT APRINT BFOR I=1 TO 5C=A+BPRINT CA=BB=CNEXT IEND SUBA.
I A B C - 4 5 - 1 4 5 9 2 5 9 14 3 9 14 23 4 14 23 37 5 23 37 60 Output:45914233760 - Q6.Re-write the given program after correcting the bugs:CLSOPEN "emp.dat" FOR INPUT AS #1UP:Computer Science (Optional Second) 723INPUT "ENTER NAME";NSINPUT "ENTER DEPARTMENT";D$INPUT "ENTER POST":PSINPUT "ENTER SALARY";SLWRITE #2, NS,D$,PS,SLINPUT "DO YOU WANT TO ADD MORERECORD?(Y/N)"; ANSIF UCASES(ANSS)="Y" THEN GOTO UPCLOSEENDA.REM add some more record on a sequential data file "emp.dat"CLSOPEN "emp.dat" FOR APPEND AS #1UP:INPUT "ENTER NAME"; NS$INPUT "ENTER DEPARTMENT"; D$INPUT "ENTER POST"; PS$INPUT "ENTER SALARY"; SLWRITE #1, NS, PS$, SLINPUT "DO YOU WANT TO ADD MORE RECORD? (Y/N)"; ANS$IF UCASE) = "Y" THEN GOTO UPCLOSE #1END
- Q7.Study the following program and answer the given questions:DECLARE FUNCTION TESTS(A$)CLSA$="KATHMANDU"B(A$)PRINT B$ENDFUNCTION TEST$ (A$)FOR I = 1 TO LEN(A$)D(A$,1,1)IF I MOD 2-0 THENC+UCASE)ELSEC+LCASE)END IFNEXT ITESTEND FUNCTIONa. What is the name of the function procedure?b. List the library functions used in the program.A.The name of the function procedure is TEST$.Library functions used in the program are:• LEN• MID$• UCASE$•LCASE$
Practice Without Boundaries.
Premium gives you full access, zero ads, and unlimited custom paper generation. Study your way, every day.
Group C
- Q8.Convert/ calculate as per the instruction:(a) Convert (511)₁₀ to binary(b) Convert (756)₈ to hexadecimal(c) Compute 1001₂ × 101₂ − 11₂ and express result in binary(d) Divide 1001001₂ by 11001₂A.
Division Quotient Remainder 511 ÷ 2 = 255 255 1 255 ÷ 2 = 127 127 1 127 ÷ 2 = 63 63 1 63 ÷ 2 = 31 31 1 31 ÷ 2 = 15 15 1 15 ÷ 2 = 7 7 1 7 ÷ 2 = 3 3 1 3 ÷ 2 = 1 1 1 1 ÷ 2 = 0 0 1 Writing remainders from bottom → top, we get:(511)₁₀ = (111111111)₂Conversion from Octal to Decimal:Octal digit Place value (8^n) Value (digit × place) 7 8² = 64 7 × 64 = 448 5 8¹ = 8 5 × 8 = 40 6 8⁰ = 1 6 × 1 = 6 Total 448 + 40 + 6 = 494 So (756)₈ = 494₁₀.Then,Conversion from Decimal to Hex (dividing by 16):Division Quotient Remainder 494 ÷ 16 = 30 30 14 → E 30 ÷ 16 = 1 1 14 → E 1 ÷ 16 = 0 0 1 Hence, (756)₈ = (1EE)₁₆Converting the binary numbers to decimal:Binary Decimal 1001₂ 9 101₂ 5 11₂ 3 Multiplying and subtracting in decimal:9 × 5 = 4545 − 3 = 42Then,Converting 42₁₀ to binary (dividing by 2):Division Quotient Remainder 42 ÷ 2 = 21 21 0 21 ÷ 2 = 10 10 1 10 ÷ 2 = 5 5 0 5 ÷ 2 = 2 2 1 2 ÷ 2 = 1 1 0 1 ÷ 2 = 0 0 1 Hence, 1001₂ × 101₂ − 11₂ = (101010)₂Converting to decimal:Binary Decimal 1001001₂ 73 11001₂ 25 Integer division in decimal:73 ÷ 25 = 2 remainder 23Converting quotient and remainder back to binary:- Quotient 2₁₀ = 10₂
- Remainder 23₁₀: divide by 2
Now,Division Quotient Remainder 23 ÷ 2 11 1 11 ÷ 2 5 1 5 ÷ 2 2 1 2 ÷ 2 1 0 1 ÷ 2 0 1 Taking the remainders from bottom → top: 10111₂Hence, 1001001₂ ÷ 11001₂ = 10111₂ - Q9.a. Write a program in qbasic that ask the radius and height of a cylinder then calculate its volume and total surface area. Create a user-defined function VLM(r,h) to calculate volume and sub- procedure TOTSA(r,h) to calculate total surface area of a hemisphere. [Hints: TSA=2πr(r+h), V=πr²h]A.DECLARE FUNCTION VLM(r, h)DECLARE SUB TOTSA(r, h)CLSINPUT "Enter radius: "; rINPUT "Enter height: "; hPRINT "Volume = "; VLM(r, h)CALL TOTSA(r, h)ENDFUNCTION VLM(r, h)VLM = 3.14 * r * r * hEND FUNCTIONSUB TOTSA(r, h)TSA = 2 * 3.14 * r * (r + h)PRINT "Total Surface Area = "; TSAEND SUB
- Q.b. A sequential data file called "marks.dat" has stored data under the field heading student's name, Eng, Nep and Math. Write a program to display all the records whose marks is greater than 35 in all subjects.A.CLSOPEN "marks.dat" FOR INPUT AS #1WHILE NOT EOF(#1)INPUT #1, N$, ENG, NEP, MATHIF ENG > 35 AND NEP > 35 AND MATH > 35 THENPRINT N$, ENG, NEP, MATHEND IFWENDCLOSE #1END
- Q10.Write a program in C language to ask to enter a number then find out whether it is odd or even number.OR,Write a C program to display the sum of first 20 even number.A.#include <stdio.h>int main() {int n;printf("Enter an integer: ");scanf("%d", &n);if (n % 2 == 0)printf("The number is even. ");elseprintf("The number is odd. ");return 0;}#include <stdio.h>int main() {int i, sum = 0;for (i = 1; i <= 20; i++) {sum += 2 * i;}printf("Sum = %d ", sum);return 0;}