Q.7) What is the difference between Sequential and Random files? Answer: Files: Files are used to store data and information that are needed for the execution of a program. Sequential Files:
Sequential files store data in a particular sequence. The record from these files can not be access directly. These files are slow. Tapes are the example of sequential files. Random Files: Random files also store data in a sequence but it can be access easily. The record can be access directly. Random files are efficient as compare to sequential files. Disks are the example of random files. Q.8) Describe the way of opening, closing, reading and writing to a sequential file. Answer: 1. Opening a File: In order to create or access a sequential file, the file must be open using OPEN statement. Syntax: OPEN “filename.ext”FOR mode AS # [buffer] Example: Open \"STUDATA.DAT\" FOR OUTPUT AS#1 Explanation: In above example, the open statement opens the file STUDATA.DAT for output, if it already exists then it will be overwritten on disk. 2. Writing a File: Writing into file that is opened by using OPEN statement is called writing a file. Syntax: WRITE # [buffer] Example: WRITE # name, address, phone Explanation: This statement would write data that is contained in name, address, phone to the file using buffer. The write statement basically transfers data to the buffer. 3. Reading a File: Reading data from file that is opened is called reading a file. Syntax: INPUT # [buffer]
Example: INPUT#1, stuName, gpa, grade Explanation: This statement would take values that are contained in file with buffer number 1 and assign each value to the specific variable one at a time. 4. Closing a File: After use, the file must be closed using close statement. Syntax: CLOSE # [buffer] Example: CLOSE #1, #2 Explanation: All currently opened files would be closed by using CLOSE statement. Q.9) Differentiate between data file and program file. Answer: Difference between Data File and Program File: Factors Data File Program File Definition Data files contain data and Program files contain program and information about program. instructions that are useful for computer program. Operations Data files are associated with program These files perform different operation files at the time of program execution. such as sorting, reading and writing. Example Files with the extension of jpg, .png Files with the extension of .c, .exe, and and .mp3 are the example of data .java are the example of program files. files. Q.10) Write down the purpose of the following functions: i) ABS() ii) INT() iii) SQR() iv) SIN() v) TAB() Answer: i) ABS () function returns absolute value. ii) INT () function returns lowest value of integer. iii) SQR () function returns square root of all positive numbers. iv) SIN () function is used to find trigonometric ratio. v) TAB () function is used to print column. Q.11) Write a program to get full name of any person and return the number of characters in his first name.
Answer: 10 CLS 20 INPUT “Enter name:”;N$ 30 FN= LEN(N$) 40 FOR K=1 TO FN 50 IF MID$(N$,K,1)<>(\" \")THEN C=C+1 ELSE PRINT \"First name is\";C \"Total Character\" :END 60 NEXT 70 END Q.12) Write a program that print ASCII characters from 1 to 255. Answer: Program to print ASCII Characters: 10 CLS 20 FOR n=0 TO 255 30 PRINT CHR$ (n); 40 NEXT n 50 END Q.13) Write a program that is used for the conversion of temperature from Celsius scale to Fahrenheit scale with the help of DEF FN function. Answer: Conversion of Temperature from Celsius scale to Fahrenheit scale: 10 CLS 20 DEF FN A(c)=9/5*C+32 30 INPUT “Enter the temeprature in Celsius =”;C 40 PRINT “Temperature in Fahrenheit =”;FN A(c) 50 END Output: The output of the program is as follows:
Q.14) Write a program to calculate and print following formula by using user-defined function. Combination = n!/k! (n-k)! Answer: Program to Print formula Combination = n!/k! (n-k)! : 10 CLS nf = 1: kf =1: df =1 20 DEF myfun(n,k,l)-n/(k*l) 30 INPUT “Please enter value of n” ; n 40 INPUT “Please enter value of k” ; k 50 FOR c=1 TO n 60 nf=nf*c 70 NEXT 80 FOR d= 1 TO k 90 kf=kf*d 100 NEXT 110 dnk=n-k 120 FOR e=1 to dnk 130 df=df*e 140 NEXT 150 PRINT “combination=n!/k! (n-k)!” ; myfun(nf,kf,df) 160 END Output: The output of the program is as follows:
Q.15) Write a program to implement a telephone directory using sequential access files. Your program should be capable of writing the name, telephone number and address of your friends to a sequential file. Answer: To Create a File and Insert Data: 10 REM Program To Create a File and Insert Data 20 CLS 30 OPEN “Documents\\Directory.txt” FOR OUTPUT AS#1 40 INPUT “Please enter number of records” ; rec 50 WRITE #1, rec 60 FOR M=1 TO rec 70 INPUT “Please enter name of person” ; N$ 80 INPUT “Please enter telephone no. of person: ; TN$ 90 INPUT “Please enter address of person” ; ADS$ 100 WRITE #1,N$, TN$, ADS$ 110 NEXT M 120 CLOSE #1 130 REM Open Data File and Read Data from it 140 OPEN “Documents\\Directory.txt” FOR INPUT AS #2 150 INPUT #2 ,rec 160 FOR M=1 TO rec 170 INPUT # 2,N$,TN$,ADS$ 180 PRINT “Number of records = ” ; rec 190 PRINT “Name of person = ” ;n$ 200 PRINT “Telephone number of person = ” ; TN$ 210 PRINT “Address of person = ” ; ADS$ 220 NEXT M 230 CLOSE #2 240 END Output: The output of the program is as follows:
i) Which of the following is not a valid graphic mode command? A. LINE B. PSET C. COLOR D. None of them ii) The number background colors available in BASIC is: A. 4 B. 8 C. 12 D. 16 (iii) Which function changes the way of displaying output in BASIC? A. SCREEN B. PRINT C. LEFT$ D. ABS iv) On color monitors, SCREEN modes are of : A. 2 types B. 3 types c. 4 types
D. 5 types v) Normally the computer monitor screen is in: A. Graphic mode B. Text mode C. Both a and b D. None of them vi) A line can be draw with the following statement A. LINE B. DRAW C. Both a and b D. None of them vii) The prefix “B” in DRAW statement is used for: A. Draw a block B. Move with black mark C. Both a and b D. Move with blue mark viii) The set of colors RED, GREEN and BROWN is given in: A. Palette 0 B. Palette 1 C. Both a and b D. None of them ix) The CIRCLE statement can also be used to draw a/an: A. Line B. Box C. Ellipse D. pset x) In medium resolution screen mode colors for foreground are: A. 1
B. 2 C. 4 D. 16 Lesson 3 - True/False Q.4) Define Graphic. Give the names of graphic modes. Answer: Graph: Graph is an art of designing data and information in form of graphics and pictures. Graphic Modes: In GW-BASIC, There are three modes to display data: I. Text Mode II. Medium Resolution Graphic Mode III. High Resolution Graphic Mode Q.5) What are the coordinates of text mode, medium resolution mode and higher resolution mode? Answer: I. Text Mode: (screen 0) has 80 column*25 rows pixels. II. Medium Resolution Graphic Mode: (screen 1) has 320 columns*200 rows pixels. III. High Resolution Graphic Mode: (screen 2) has 640 columns*200 rows pixels. Q.6) Describe the SCREEN Statement. Answer: SCREEN Statement: Purpose: Screen statement is used to set the specification for display according to hardware. Syntax: SCREEN [mode] [,[colorswitch]][,[apage]][,[vpage]] Explanation of Syntax: In the above syntax of SCREEN statement, the screen mode has integer values from 0 to 10 and color is used to select display colors. Example: SCREEN 1 COLOR 1, 2, 3 'forground=1, background=2, border=3
Description of Screen Modes: Screen mode 0 is default mode. Screen mode 1 is medium resolution mode. Screen mode 2 is high resolution mode. Q.7) Write the syntax of CIRCLE statement. Also give example for explanation. Answer: Syntax of CIRCLE statement: CIRCLE(x,y),radius [,[color] [,[start],[end][,aspect]]] Explanation of Syntax: In the above syntax of a CIRCLE statement, x and y are the coordinates of the center of a circle. Radius is the radius of a circle and color states the color of a circle. The start and end are parameters that specify where the drawing of a circle is to begin and end aspect describes ratio (x:y). Example: 10 REM Draw a circle 20 CLS 30 SCREEN 2 40 CIRCLE (80,120), 40, 1,,,1 50 END Q.8) Compare and differentiate LINE and DRAW statements. Answer: Comparison of LINE and DRAW Statement: LINE Statement DRAW Statement Definition Draw statement is used to draw lines including other shapes. Line statement is used to draw line. The shapes can be drawn through string specification. Drawing It can draw line between two sectors. DRAW string expression Syntax LINE [(x1,y1)]-(x2,y2) [,[attribute][,B[F]][,style]] DRAW \"R50 D50 L50 U50\" Example LINE (0,0)-(100,175),,B Q.9) Find out the errors in the following if any? a) LINE (140,100) - (300-100),2, BF ,4 b) 10 SCREEN 2 20 COLOR 1,2 30 DRAW “U10 R10 D10 L10” c) 10 SCREEN 1
20 A=20 30 DRAW “U=A R=A, D=A L=A” Answer: a) Symbol (-) that is placed between coordinates (300-100) should be replace by (,) therefore it is (300,100) b) PSET (250,50) is used to draw box, it should be placed in the LINE number 20 so remove color 1,2 c) DRAW “U20 R20 D20 L20” should be placed in LINE number 30 instead of DRAW “U=A R=A,D=A L=A” Q.10) What will be the output of the following. a) 10 SCREEN 2 20 PSET(250,50) 30 DRAW “G50 R100 H50” 40 END b) 10 SCREEN 2 20 FOR I = 30 TO 180 30 CIRCLE(1,100), 50 40 NEXT Answer: a) 10 SCREEN 2 20 PSET(250,50) 30 DRAW “G50 R100 H50” 40 END
Figure showing the output b) 10 SCREEN 2 20 FOR I = 30 TO 180 30 CIRCLE(1,100), 50 40 NEXT
Figure showing the output Q.11) Write a program to draw a star. Answer: Program to Draw a Star: 10 REM Draw a Star 20 CLS 30 SCREEN 2 40 LINE (370,150)-(330,80) 50 LINE-(260,150) 60 LINE-(405,105) 70 LINE-(240,105) 80 LINE-(370,150) 90 END Output:
Q.12) Define the COLOR statement. How many color backgrounds are available with color statement? Answer: COLOR Statement: Color statement is used to select or change different colors of display. Syntax of COLOR Statement: COLOR [foreground] [,[background], [,border]] Example: SCREEN 0 COLOR 1, 2, 3 'foreground=1, background=2, border=3 Available color with COLOR Statement: There are 0 to 7 background colors are available with color statement. Q.13) Define the Palette. Answer: Palette: The palette statement has set of colors that are used to make changes in PSET, DRAW, LINE and CIRCLE statement. Syntax of Palette: PALETTE [attribute, color] Example: 40 FOR I=100 TO 0 STEP-1 50 PSET (1,1), 0 60 NEXT I
Explanation: The above program set each pixel to 0 in order to clear out the lines. Q.14) Briefly discuss the PIXEL. Answer: Pixel: Pixels are basically picture elements and they are used in digital imaging. Arrangement of pixel: Pixels are arranged in rows and columns in order to produce complete image. Specific Color for Pixel: The specific color described by pixel is some blend of three components of the color spectrum - RGB. RGB is the combination of RED, GREEN, BLUE. Screen and Pixel: The screen of a computer is a combination of different pixels.The more megapixels enhances the quality of image. Bitmap: Bitmap is a file that indicates color for each pixel. Q.15) Write a program to produce five concentric circles of different radii. Answer: Program to produce five concentric circles of different radii: 10 CLS 20 REM produce five concentric circles of different radii 30 SCREEN 1 40 CIRCLE (100,100),15,5 50 CIRCLE (100,100),25,4 60 CIRCLE (100,100),40,3 70 CIRCLE (100,100),65,8 80 CIRCLE (100,100),50,4 90 END Output:
Q.16) Write a program to draw a parallelogram by using DRAW statement. Answer: Program to Draw Parallelogram: 10 CLS 20 SCREEN 2 40 PSET(250,50) 30 DRAW \"R55 E20 L55 G20\" 40 END Output: i) Which keyboard shortcut is used for double underline? A. Ctrl + Shift + D B. Ctrl + [
C. Ctrl + Shift + M D. Shift + F3 ii) MS Word is a _______________ based program. A. Windows B. System C. DOS D. None of them iii) Which of the following bars provide the information about application software? A. Menu bar B. Tool bar C. Status bar D. Scroll bar iv) Press Ctrl + 2 keys for_________ spacing. A. Single B. Double C. Triple D. None of them v) Clicking on the Print icon____________ prints the document currently active in Word. A. manually B. automatically C. (a) and (b) D. None of them vi) Which of the following is used to select the paragraph? A. Single-click B. Double-click C. Right-click D. None of them vii) Ctrl + Y is used for
A. Undo B. Find C. Page break D. Redo viii) Which one option is not in Edit Menu? A. Undo B. Redo C. Find D. Font ix) Which keyboard'shortcut is used to make the selected word bold? A. Ctrl + Shift + B B. Shift + B C. Alt + B D. Ctrl + B Lesson 3 - True False Q.4) What is meant by Title Bar? Answer: Title Bar: 1. Title bar is positioned at the top of the screen. 2. Titlebar displays the title of the currently opened application, software or document. 3. It has three control buttons named as Minimize, Restore, Close. Minimize: Minimize button reduces the window to an icon on the Taskbar. Restore: Restore button expands to fill the screen. Close: It is used to close the document. Example: In this figure representing \"Sales Report 2011.dox-Microsoft Word\" is a title bar which describes the titile of currently opened document. It also has three control buttons on the right side.
Q.5) Describe the use of clipboard in MS-Word. Answer: Use of Clipboard: Clipboard is used in MS Word to copy and paste the text. When text is being selected for paste ,it can viewed in clipboard to paste it anywhere. How to display Clipboard in MS Word: Step 1: Open Microsoft Word and click the “Home” tab on the command ribbon. Step 2: Click the “Dialog Box Launcher” button in the Clipboard group to open the Clipboard pane. Step 3: Click the “Options” button at the bottom of the Clipboard pane to open the list of options, and then click “Show Office Clipboard When Ctrl+C Pressed Twice.” Step 4: Click the “X” or “Close” button on the task pane to close the Clipboard. Step 5: Click outside your document in the margin or status bar. Press “Ctrl-C” twice to display the Clipboard pane. Q.6) How would you customize your toolbars? Answer: Customizing Toolbar: To add command that does not appear on the toolbar, go to the customize toolbar option. Steps: In order to customize your toolbar, follow these steps: i. On the Tools Menu, by clicking customize, go to Toolbars tab. ii. In the Toolbar name, type name of the toolbar or select from list. iii. Drag desired commands from right column to the toolbar. iv. Click OK to apply changes.
Q.7) What is meant by Drop Cap? Answer: Drop Cap: Drop Cap is an option, which is used for adding first capital letter in a paragraph. How to use Drop Cap: 1. Open your document in MS Word. 2. Click in the paragraph where you want to add a drop cap. 3. On the Insert tab, in the Text group, click Drop cap. 4. Click Dropped or In margin. Q.8) Differentiate between Formatting Toolbar and Standard Toolbar Answer: Difference between Formatting and Standard Toolbar:
Formatting Toolbar Standard Toolbar Definition Formatting toolbar is used to format Standard toolbar allows basic the text. operation on document. Formatting can be done using Standard toolbar provides an option Options alignments, font type, font size and to open, save, print and spell check. list. Supportability Formatting toolbar enhances quality Standard toolbar is concerned with of text. document. Q.9) Define the different views of the document. Answer: Different Views of the Document: There are five types of views of the document: 1. Normal View 2. Web Layout View 3. Print Layout View 4. Outline View 5. Full Screen View Normal View: Normal view is the standard view for typing, editing and formatting a document. Figure:
Web Layout View: This view includes how your text looks like on webpage. Icon: Print Layout View: Print Layout shows how your text or document will be look like after printing. Icon: Outline View: This view includes heading of the page. Icon:
Full screen View: Full screen view displays only current document. Icon: Q.10) How can you run the spell checker of MS-Word? Answer: Definition of Spell Checker: Spell checker is a software tool that is used for correcting spelling. Advantages: Spell checker Provides an option of Suggestion list from where correct word can be accessed. It corrects the words and spellings. It highlights the grammer mistakes.
Steps: Following steps should be follow in order to run spell checker: 1. Open a Word document that needs to be checked. 2. Go to the Review tab. 3. Click on Spelling and Grammar. 4. When Spelling and Grammar dialog box appears, the first correction is highlighted. 5. Correct the word according to dictionary or ignore it. Shortcut KeyTo Run Spell Checker: To run the spell checker of MS Word, simply press F7. Q.11) What is the use of Print Preview? Answer: Use of Print Preview: Print Preview is the option in MS Word that shows how your document will be look like after printing. Many pages can be viewed at the same time with this option. Shortcut Key for Print Preview: The shortcut key for print preview is Ctrl+F2. Steps to Use: 1. Open your document and click on File tab. 2. From File tab, Go to the print option. 3. A preview of your document automatically appears. 4. To view each page, click the arrows below the preview. Figure:
Q.12) What are the methods for changing the margins in a document? Answer: Methods for Changing the Margins in a Document: Rulers are used to change the page margin.There are two methods for changing the margins in a document: Method 1: 1. Open a MS Word document. 2. Place the cursor from where you want to set page margin. 3. Click on the ribbon icon that is positioned with vertical bar. 4. Now ruler become visible. 5. Drag mouse untill it become double-ended arrow. 6. When margin is set, stop dragging mouse i.e. release mouse left button. Figure:
Method 2: Margin can be set by using page setup option: 1. Open a MS Word document. 2. Click on Page layout tab. 3. Select page setup option. 4. Window appears with a lot of option. 5. Select options to set page margin. 6. Click OK to apply changes. Figure: Q.13) Differentiate between Alignment and Indent in MS-Word.
Answer: Difference between Alignment and Indent: Alignment Indent Definition Alignment is an arrangement of text Indentation is an option to shift text form Options Criteria from left to right and right to left. left or right margin. There are different options available There are many options to indent text such such as Align Left, Centre, Align as First Left indent, Hanging indent and Right. Right indent. Alignment is usually applied to the Indentation is applied to specific selected first line of paragraph. area.
Search