Question
1. What is the output of the following statements? case `date | cut -d -f1` in Mon|Sun) echo Have a good day ;; Tue|Fri) echo
1.
What is the output of the following statements?
case `date | cut -d -f1` in
Mon|Sun) echo "Have a good day" ;;
Tue|Fri) echo "Will it rain today?" ;;
Thu) echo "This is the day" ;;
*) ;;
esac
a. | Will it rain today? | |
b. | Have a good day | |
c. | This is the day | |
d. | Nothing is printed |
2.
If the options in the script foo -l -t bar[1-3] are combined, what will the value of $# be? Consider that the files bar1, bar2, and bar3 already exist.
a. | 3 | |
b. | 4 | |
c. | 5 | |
d. | 6 |
3.Write a Perl script that will print all the elements of the array, @myArr = ('perl', 'python', 'awk', 'shell', 'sed').
4.
What is the output of the following code snippet?
@days = qw/Mon Tue Wed Thu Fri Sat Sun/;
@weekdays = @days[4..6];
print "@weekdays ";
5.
What is the output of the following code snippet?
$result = "This is \"number\"";
print "$result ";
print "\$result ";
6. Write a program that prompts for an integer not exceeding 255, and then prints A if the number is below 127, B if it is below 224, and C otherwise.
7.
What is the output of the following code snippet?
@nums = (1..20);
print "Before - @nums ";
splice(@nums, 5, 5, 21..25);
print "After - @nums ";
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started