Created
December 6, 2021 07:16
-
-
Save rozer007/ce0562e0ee78a9122ccd7811b3f1ec80 to your computer and use it in GitHub Desktop.
MATH AND CONDITIONAL IN PERL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1. what will be the return value if a condition is false? | |
ans: 0 or " ". | |
Q2.What are switch statement called in perl? | |
ans: Given and when statement. | |
Q3.What is the math function to convert a hexadecimal to decimal? | |
ans: Hex function syntax: hex hexadecimal value. | |
Q4.How can we get a random value between 0 and 1? | |
ans: rand() , this will give the random value between 0 and 1. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1. my $r=int(rand(2)) | |
print $r; | |
Is there any possibility that the above code will give output as 2: | |
a) Yes | |
b) No | |
Q2.What will be the output of this code : | |
my$x=2; | |
print $x++; | |
print $x--; | |
a) 23 | |
b) 32 | |
c) 3 | |
2 | |
d) None of the above | |
ans: a) | |
Q3.What is the correct way to use shorthand assignment operator? | |
a) += | |
b) =+ | |
c) ++= | |
d) none of the above | |
ans: a) | |
Q4) What will the output of this statement : | |
my$x=9; | |
print oct(hex($x)); | |
a) 9 | |
b) 0 | |
c) -1 | |
d) 8 | |
ans : b | |
Q5. What will be the output of the statement: | |
print 5!=4; | |
a) false | |
b) true | |
c) 1 | |
d) 0 | |
ans: c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment