Practical Extraction Report language
One-mark questions:
1. The most common languages in CGI script are used _________ .
a) Perl & C b) Perl & Oracle c) Perl & Cobol d) None
2)________library function is used to output in the browser.
a) Output b) Write c) Done d) Print
3) Perl Stands for________________.
a) Practical Extraction and Report Language b) Practical Execution & Report Language
c) Practice Extra Scripting Language d) None
4) In perl any line starting from __ symbol is called as comment.
a) $ b) # c) & d) /* */
5) __________ is most preferable language when writing CGI scripts.
a) Perl b) Cobol c) Java d) Visual Basic
6) Perl was created and still maintained by _______
a) Blacksmith b) Larry Anderson c) Larry Wall d) None
7) ___ is the symbol is used to represent an array variable.
a)$ b)& c)@ d) None
8) The file extension of perl is ___________
a) .pl b) .PERL c) .PEL d) None
9) Perl needs _________ for programmers getting executed.
a)Interpreter b)Executer c) perlengin d)None
10) CGI Stands for_________________.
a) Common Gateway Interface b) Complex Gate Interaction
c) Both A and B d) None
11) To assign a value to a scalar variable perl makes use of ____________ operator.
a) = = b) . c)# d) =
12) ___________ statements lets you perform are iterative operations in perl
a) Loops b) Conditional Structure c) Marquee d) None
13)¬________ variable is called default variable in perl.
a) Boolean b) Integer c) Scalar Variable d) None
14) A variable name can be given unto ______ number of characters long.
a) 256 b) 255 c) 257 d) 254
15) ____ operator is used in perl when data type is string when it is less than.
a) lt b) < c) less than d) None
16) In perl \n stands for __________________
a)new line b)previous line c) Current line d)None
17) CGI script extension is __________________
a).CGI b) CGIS c).CG d) None
18)The present version of Perl is ______
a) 5 b) 4 c) 3 d) No version
19)_________ allows string to convert in to uppercase upto end of string in perl.
a) \u b) \U c) /L d) None
20) _____retrieves reminder resulting from division.
a) % b) Mod c) Div d) None
21) __________________ restarts the iteration of a loop in perl.
a) Continue b) Restart c) Repeat d) None
22) In perl _____ concatenates two strings.
a) . b) + c) | d) ||
23) A __________________ is a sequences of scalar variables enclosed in parenthesis.
a) List b) Array c) Both a & b d) None
24) To refer ‘AND’ that is logical operator in perl __________________ character is used.
a) && b) = = c) And d) None
25) __________________ returns a list containing the elements of array in sorted number in Perl.
a) Sort b) Sorted c) None d) Sorting
26) ____ operator is used for concatenation and assignment.
a).= b)=. c) =.= d) None
27) CGI is just a __________________ --program in a file that has the extension CGI.
a) Perl b) Cobol c) Unix d) None
28)In perl before writing or reading from file the file must be Opened with ____
a)open b)Open c)OPEN d) None
29) Perl is case sensitive language.
a) True b)May be c)False d)None
30)Which of the following is an invalid scalar variable.
a)$var b)$var_2 c)$x d)$2var
31) _____supplies the values in URL for CGI script
a)Method b)Get c)Post d)Action
32) ____ returns the number of rows in case of perl.
a)Row number b)rowcount c)Row counting d)None
33)Cgi is a programming language
a)True b)False c)May be d)None
34)Any sub routine definition in perl should start with __________________
a)sub-routine b)sub c)subroutine d)subrow
35) _________ compare operator is being used in case of string comparison operators.
a)camp b)compare c)comp d)cp
36) __________________ not equal to symbol is being used in case string comparison operators.
a)NETO b)not c)NTS d)ne
37)In perl there are ___ file access modes.
a)3 b)2 c)4 d)1
38)To write to a file, File must be opened in ___
a)open(SS,”file.txt”) b)open(SS,”>file.txt”) c)Both d)None
39) Any subroutine call must be starting with ______
a) $ b) * c) & d) #
40)Perl automatically closes the file when the programme
a)Terminates b)Start c)Load d)None
41)________ statement restarts the iterations of a loop. a)Redo b)Redoing c)Continuing d)Stop
42) __________________ -is a separate body of code desgned to performed a particular task in perl
a) Subroutine c)Procedure d)Function d)All
43) The m// operator is __________________ - operator in perl
a)Match b)Compare c)Substitute d)translate
44)In perl Redo statement can not be used with ___________statement.
a)or b)do c)and d)Next
45)To terminate a particular iteration of a loop __________________ statement is used in perl.
a)next b)Stop c)continue d)None
46)a _____ is a sequences of scalar variables enclosed with in parenthsis.
a)List b)Scalar c)Scalar Value d)None
47)____________appends one array2 at the end of array1 the length of array is indexed in perl
a)push b)sort c)round d)increase
48)Perl enables to store the list in special variables called _____________ variable.
a)Scalar b)List c)Array d)Variable
49) In subroutine _____ statement is used for defining variables only inside a subroutine.
a) local b) my c) Both d) None
50) In subroutine _____ statement is used for defining variables not for main but for subroutine and any
subroutine called by the subroutine.
a) local b) my c) Both d) None
51) The list which can be accessed by index value only are called as ____.
a) Arrays b) Associative arrays c) Both d) None
52) The list which can be accessed by any scalar value called as ____.
a) Arrays b) Associative arrays c) Both d) None
53) The _______ module is used to process the form.
a) CGI.pm b) CGI.pl c) cgi-lib.pl d) cgi-lib.pm
54)For database access in perl ________ module is used.
a) Win32::ODBC b) Win32::odbc c) win32::ODBC d) win32::Odbc
55) ________ function fetches the next row of data list.
a) NextRow() b) FetchRow() c) fetchRow() d) None
56) The _____ list can retrieve the data in scalar form as well as array form.
a) Data( ) b) DataHash( ) c) Both d) None
57) _____ returns the error in the form of string or array.
a) DumpError( ) b) Error( ) c) Both d) None
58) _____ returns the error on the screen.
a) DumpError( ) b) Error( ) c) Both d) None
59) _____ is used only in debugging.
a) Sql( ) b) Run( ) c) Both d) None
60) The ____ option with file return how long since file accessed.
a) –a b) – A c) Both d) None
Two mark Questions
1)The correct way to represent a octal value is
a)A character ‘o’ at the end of a numerical value like 47o
b)A character sequence ‘ox’ preceding the numerical value like ox47
c)A zero preceding the numerical value 047
d)None of the above
2))What are the values assigned to $var1 and $var2 after executing the following code?
$var1=43;
$var2=++$var1;
a)43,44 b)44,44 c)44,43 d)43,43
3) What is assigned to $scalar?
@array=(1,”one”,20,30,”Hello”);
$scalar=$array[2];
a)30 b)“one” c)20 d) error
4)What are the elements of an array called @array after the following code is executed ?
@array=(1,2,3);
$array[5]=”one”;
a)(1,2,3,”one”) b)1,2,3,””,””,”one”) c)(“”,”“,””,””,””, ”one”) d) error
5)What is the list assigned to @ array2 after executing the following code snippet
@array1=(1,2,5,”one”,”two”,”2.5,3,300);
@array2=@array1[2,5];
a)(2,5) b)(2,5,”one”,”two”) c)(5,”one”,”two”,2.5) d)(5,2.5)
6)what is assigned to $popped and @array after the execution of the following code snippet
@array1=(1,2,3,4,5);
$popped=pop(@array);
a)$popped will be assigned with 5 and @array is assigned with the list (1,2,3,4,5)
b)$popped will be assigned with 1 and @array will contain (1,2,3,4,5)
c)$popped will be equal to 5 and @array is assigned with the list (1,2,3,4)
d)$popped will be not be assigned with anything and @array remains the same
7)How to instruct a PERL script to load ‘win32::ODBC’?
a)Require win32::ODBC b)Load win32::ODBC c)Use win32::ODBC
d)Need not explicitly do that as the feature is built-in in PERL
8)The method used for displaying all the query results onto the screen for debugging purpose is(Assuming $db represents the database object)
s)$db->DUMP() b)$bd->DisplayAll() c)$db->DumpError() d)$db->DumpData()
9) Which of the following is True?
i)CGI is the part of your web site that communicates with other applications running on your server
ii)CGI applications or scripts is to give you more interactivity on your web site
iii)CGI scripts can be written in any language
a)I,ii b)I,ii,iii c)ii,iii d)None
10)Which of the following is True?
i)The correct number of digits a machine can store is known as precision
ii)Strings in Perl do not contains a hidden null character at the end of the string
iii)Scalar variables are not replaced by their values in single-quoted strings
a)I,ii b)ii,iii c)I,ii,iii d)None
11)Which of the following is True?
$result1=”123” < ”45”;
$result2=”123” lt “45”;
i)$result1 value is false
ii)$result2 value is true
iii)$result1 and $result2 values are true
a)Only (i) b)Both (i) and (ii) c)Only (iii) d)Only (ii)
12) Which of the following is True?
i) –f operator will check the file is ordinary file or not
ii) -W operator will check the file is writable or not
iii)–w operator will check the file is writable by the “real user “ or not
a)Only (i) b)Only (ii) c)Only (iii) d)(i),(ii),(iii)
13) Which of the following is True?
i) ^ or \A anchor is used to find match at beginning of string only
ii)$ or \Z anchor is used to find match at the end of string only
iii)\B anchor is used to find match on word boundary
a)Only (i)(iii) b) Only (ii)(iii) c)(iii)(i)(ii) d)Only (i)(ii)
14) Which of the following is True?
%fruits=(“apples”,17,”bananas”,23,”cherries”,11,45);
@x=keys(%fruits); @y=values(%fruits);
i) @x result is apples bananas cherries 45
@y result is 17 23 11
ii) @x result is apples bananas cherries
@y result is 17 23 11 45
iii) @x result is apples bananas cherries
@y result is 17 23 11
a)Only (i) b)Only (ii) c)Only (iii) d)None
15)Which of the following is True?
$a=10; $b=20;
&test($a,$b);
sub test
{
my($x,$y)=@_;
&test1;
}
sub test1
{
$c=$x + $y;
print”$c”;
}
a)The value of $c is 30 b)The value of $c is 0 c)The value of $c is Null d)Error
16)Which of the following is True?
i) The Sql() method will return Non-zero value if it successful
ii)The Client Data will store in scalar array in server disk
iii)FieldNames() Method will return field names of a table
a)Only (i)(iii) b)Only(i)(ii) c)Only (ii)(iii) d)All
Four mark Questions
1)Which among the following statements is false with respect to creating a virtual directory in personal web server for executing the PERL programs
a)To add the virtual directory, One should first click on the ‘advanced’ icon in the personal web manager window
b)In the ‘Add Directory’ window, one should check all the 3 boxes (Read, Execute and Script)
c)In the ‘Directory ‘ field one should type the real path to the directory storing PERL program
d)The virtual directory is usually added under the ‘
2.what is the meaning of the following code? open(MYFILE,”file1”);
a)A file called MYFILE is opened and the file handle is assigned to file 1
b)A file called file1 is opened in read mode and file handle is assigned to ‘MYFILE’
c)A file called file1 is opened in write mode and file handle is assigned to ‘MYFILE’
d)A file called file1 is opened in append mode and the file handle is assigned to ‘MYFILE’
3. What is the correct syntax for reading from a file that is opened in read mode and the file handle if READFILE
a)$line=
d)$line=fscanf(READFILE);
4.Which among the following statements is wrong with respect to ‘for’ loops?
a)‘for’ loop is better structured than ‘while’ loop
b)‘for’ loop evaluates the condition expression before entering into the loop for the first time
c)In a ‘for’ loop initialiser, termination condition and condition expressions are mandatory.
d)‘continue’ and ‘last’ statements can be used inside a ‘for’ loop
5.Which among the following statements is true?
a)‘for’ loop will execute at least once regardless of the condition expression
b)‘while’ loop will executed at least once regardless of the condition expression
c)‘foreach’ will be executed at least once regardless of the condition expression
d)‘do-while’ will be executed at least once regardless of the condition expression
6. Which among the following statements is false with respect to PERL subroutines?
a)It is possible to pass parameters to subroutines. this passed parameters will be available in
an array called @_
b)By using ‘my’ statement we can define local variables in a subroutine those are visible only
in the subroutine in which defined
c)It is mandatory to use return statement in subroutines to return some value to the calling
subroutines
d)Always it is advisable to invoke the subroutines using the syntax ‘&subroutineName;’
7) Which of the following is true
a) Perl have the ability to interface with the software utilities and libraries
b) Perl have the ease of text manipulation c) a&b d) none
8)find the out put the following
$x=0; until ($x<10)
{
print “ number is $x “; $x++}
a)0 1 2 3 4 5 6 7 8 9 b) 0 1 2 3 4 5 6 7 8 9 10 c)0 1 2 3 4 5 6 7 8 9 10 11 d) none
9) Define the output
$x=30 ; $y=++$x ; $x=$x++ ; print “ $x $y”;
a). 31,32 b)31,31 c) 32,33 d) none
10)define the output
$x=30; $y=++$x; $y=$x++; $x=++$y; print “ $x $y”;
print “$x and $y”
a)32,33 b) 32,32 c) 33, 33 d) none
11) Define the output
@a=(1 2 3 4 5); @a=shift(@a); print “@a”;
a)1 2 3 4 5 6 b) 2 3 4 5 c) error d) none
12) Define the output
$a= “acme college of it”
$result =$x=~tr/acme/ACME
a)ACME CollEgE of it b) ACME college of it c) error d) none
13) Define the output
$a= “acme college of it”
$result =$x=~s/acme/ACME
a)ACME CollEgE of it b) ACME college of it c) error d) none
14. Define the output
%x=(“India”,”us”,1,2,3,”UK);
@Y=VALUES (%x);
a) (us,2,uk) b)India 1,3 c) error d) none
15. Match the Following?
Set-A Set-B
i) [] character a)An element or group of elements may be omitted or may
appear zero or more times
ii) + character b)An element or group of elements may be omitted or may
appear one or more times.
iii) * character c)An element or group of elements may be any one from given.
a) I -b, ii-c, iii-a b) I- c, ii- b , iii – a c) I- a, ii- b , iii – c d) I- c, ii- a , iii - b
16) Match the Following?
Set-A Set-B
i) m a)Treat string to be matched as multiple lines
ii) s b)Change all occurrences of pattern
iii) g c)Treat string to be matched as single line
iv) e d)Evaluate replacement strings as expression
a )i-b, ii-c, iii-a, iv-d b)ii-b, iii-a, iv-c, I-d c)I-d, ii-b, iii-c, iv-a d)i-a, ii-c, iii-b, iv-d
17) Match the Following?
Set-A Set-B
i)last a)To terminate a particular iteration of a loop and terminates the
execution of the entire loop.
ii)next b) Restarts the iteration of a loop and cannot be used with do
statement
iii)redo c)Statements are executed whenever the end of while loop or
until loop is reached.
iv)conitnue d)Used for exiting a loop before the termination condition
become true .
a)i-c,ii,b,iii-a,iv-d b)I-d,ii-a.iii-b,iv-c c)I-d,ii-c,iii-b,iv-a d)I-c,ii-a,iii-b,iv-d
18) Match the Following?
Set-A Set-B
i) DataList a)Includes error number, error text and the ODBC
connection number that caused the error
ii) DataHashList b)Returns an array of values, in the order in which they
were specified.
iii)DumpError c)Returns an array of values and stored in associative
array.
a)i-c,ii-b,iii-a b)I-c,ii-a,iii-b c)I-b,ii-c,iii-a d)I-b,ii-a,iii-c
19) Match the Following?
Set-A Set-B
i)DumpData a)Returns the data in an array,with no guarantee of the order of
the names
ii)Error b)Returns fieldnames and the data in all rows of the current
data set
iii)FieldNames c)Returns the last error in the form of an array or sting.
a)I-a,-ii-b,iii-c b)I-a,ii-c,iii-b c)I-a,ii-b,iii-c d)I-b,ii-c,iii-a
20) Match the Following?
Set-A Set-B
i) –f a)How long since the name’s inode accessed
ii) –A b) Does the name has its setdig bit set
iii) –g c)How long since the name accessed
iv) –C d) Is name an ordinary file
a) I- d, ii- c, iii- b, iv-a b) I- c, ii- a, iii- b, iv-d c) I- d, ii- a, iii- b, iv-c d) I- c, ii- b, iii- a, iv-d
21) Match the Following?
Set-A Set-B
i)shift a)Returns the last element of the array
ii)Unshift b)Insert the value at the End of the array
iii)Pop c)Returns the first element of the array
iv)Push d)Insert the value at the Beginning of the array
a)i-c,ii-d,iii-a,iv-b b)I-a,ii-b,iii-c,iv-d c)I-d,ii-c,iii-b,iv-a d)I-c,ii-d,iii-b,iv-a
*************************
Answers
One marks
1.a 11.d 21.a 31.b 41.a 51.a
2.d 12.a 22.a 32.b 42.d 52.b
3.a 13.c 23.c 33.b 43.a 53. c
4.b 14.b 24.a 34.b 44.b 54. a
5.a 15.a 25.a 35.b 45.a 55. b
6.c 16.a 26.a 36.d 46.a 56. a
7.c 17.a 27.a 37.a 47.a 57. b
8.a 18.a 28.a 38.b 48.c 58. a
9.a 19.b 29.a 39.c 49.b 59. b
10.a 20.a 30. d 40.a 50.a 60. b
two mark
1.c 9.b
2.b 10.c
3.c 11.b
4.b 12.a
5.d 13.d
6.a 14.a
7.c 15.b
8.d 16.c
Four marks
1.b 11.b 21. a
2.b 12.a
3.a 13.b
4.c 14.a
5.d 15.b
6.a,b,d 16.d
7.c 17. d
8.a 18. c
9.b 19. b
10.b 20. a