














































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
NOS 120 final all sets Unlocking Knowledge: A Comprehensive Guide to the NOS 120 Final Exam All Sets.. An Ultimate Exam Study Guide Latest Updated 2025/2026 100% Certified and Verified Answers by Expert.
Typology: Exams
1 / 86
This page cannot be seen from the preview
Don't miss anything!
Write a C program called fedora.c that displays the line "Fedora is a version of Linux." - ans#include <stdio.h> int main() { printf("Fedora is a version of Linux.\n"); } Create a simple C program which declares the variable number as a local variable that is an integer. - ansint number; int main() { } Modify the rain.c program you created in this chapter so that the total of all inches of rain when added together is 136 inches. - ans#include <stdio.h> int main() { int rain, total_rain = 0; for (rain = 0; rain < 17; rain++) { printf("We have had %d inches of rain.\n", rain); total_rain = total_rain + rain; } printf("We have had a total "); printf("of %d inches of rain.\n", total_rain); } Write a program in which a prompt asks for your first name and after you enter your first name the program displays it. - ans#include <stdio.h> int main() { char string[20]; printf("\nEnter your first name: "); scanf("%s", string); printf("Your first name is: %s\n", string);
Write a program in which you enter a number and the program calculates and displays that number cubed. - ans#include <stdio.h> int main(void) { int num, cube; printf("\nEnter the number to cube: "); scanf("%d", &num); cube = numnumnum; printf("Your number cubed is: %d\n", cube); } Create a program that enables you to input a positive integer and that will then tell you if it is a prime number or if it can be divided by 2. - ans#include <stdio.h> int main (void) { int num; int count; int signal; printf("Enter the number to test: "); scanf("%d", &num); for (count=2, signal=1; (count<=(num/2)) && signal; ) { if ((num % count) ==0) signal = 0; else count++; } if (signal) printf("%d is prime\n", num); else printf("%d has %d as a factor\n", num, count); }
float my_money; int weight; cout << "\nEnter your First Name: "; cin >> string; cout << "\nEnter your Desired Monthly Income: "; cin >> my_money; cout << "\nEnter your friend's weight: "; cin >> weight; cout << "\n\n Recap\n"; cout << "I am " << string; cout << " and I wish to have " << my_money; cout << " per month"; cout << "\nI never would have guessed your friend weighs " << weight; cout << "\n\n"; } Create a C++ program that tests to see if the file accounts exists and prints a message to say whether the file exists. - ans#include
print ("Perl was developed by Larry Wall\n"); Write a Perl script in which you create a variable in the script to contain the name Beth and then have the script
display "Welcome Beth." - ans#!/usr/bin/perl
$name = "Beth"; print ("Welcome $name\n"); Modify the script you wrote in Exercise 2 so that you prompt for the name and then display "Welcome name". - ans#!/usr/bin/perl
print ("Enter your first name: "); $name =
@vegetables = ("peas", "carrots", "spinach", "corn", "beans"); print ("The vegetables on my list are:\n"); print ("$vegetables[0]\n"); print ("$vegetables[1]\n"); print ("$vegetables[2]\n"); print ("$vegetables[3]\n"); print ("$vegetables[4]\n"); Design a Perl program that sorts the last names Martin, Adams, Sandoval, Perry, Yablonsky, Brown, and Ramirez.. - ans#!/usr/bin/perl #Program name: exercise6.pl @namelist = (Martin, Adams, Sandoval, Perry, Yablonsky, Brown, Ramirez); @sortednames = sort @namelist; print "@sortednames"; print"\n"; Write a Perl program that attempts to open a file that does not exist, and that prints the message "That file is
Key Value 1 Martin 2 Hanson 3 Stephens 4 Rawlins - ans#!/usr/bin/perl
%peoplelist = ('Martin', 1, 'Hanson', 2, 'Stephens', 3, 'Rawlins', 4); print ("The keys are:\n"); print ("$peoplelist{'Martin'}\n"); print ("$peoplelist{'Hanson'}\n"); print ("$peoplelist{'Stephens'}\n"); print ("$peoplelist{'Rawlins'}\n"); dd [option] - anscopies an input file and can convert the file's contents to another format or to have different characteristics dd if - ansdesignates the input file dd of - ansdesignates the output file df [-options] [filesystems] - ansdisplays how space in a disk is allocated, used and free
s: secure mode S: cumulative mode n: specifies how many times to update b: batch update (must also use w n) i: ignores any idle processes c: displays the command line instead of teh command name only uptime - ansdisplays how long the system has been up since the last boot free [-options] - ansprovides stats about free and used memory
Start the top utility. Type? after the utility starts. What information do you see? Press Enter and stop the top utility. - anstop ? q Run the man program with the argument df in the background. Record the PID of the process you have started. - ansman df& Save and test the revised phmenu.1 file using the groff and man programs. - ansgroff - Tascii - man ./phmneu.1 | more man ./phmenu. Use the command that will enable you to view the documentation for ifconfig. Notice the many options for configuring your network connection. - ansifconfig Find out the IP address of a friend's computer or of a favorite Web site and use the command to poll that computer or Web site. - ansping [ip address] Use a command to view the contents of the /etc/init.d directory to see a listing of services you can start on your computer. Do you see the portmap file - ansls /etc/init.d dump [-options] devicename and partition or filename - ansbacks up files and directories uses 9 levels, 0: all files 1: all files since last bu, 2: since all level 1, and so on restore [-options] device partition or filename - ansrestores entire filesystems, specific files, and directories
How could you set up CALNOW so that it works every time you log in using the Bash shell?
cal
List the records in the corp_phones_bak file that you created earlier, so that they are displayed without colons separating the fields, but have one space between fields instead. - anscd ~/source cat corp_phones_bak | tr ":" " " In your source directory, write a script called "them" in which you create a function called thethat displays a listing of who is logged in and displays the column headings for the information displayed. - anscd ~/source vi them whoisthere() { who - H } Modify your whoisthere function so that you can enter "These are the folks logged in:" as an argument to appear before you list who is logged into the system. - answhoisthere() { echo "$1" who - H } How can you set up your new whoisthere function so that it can be run each time you log in using the Bash script? - ansSwitch to the home directory (cd and press Enter). Edit the .bashrc or .bash_profile login script to contain the line:. ~/source/them. Use a one line command to strip out the telephone prefix (219-) and the colons in the corp_phones_bak file and save the result in a file called noprefix? - anscd ~/source cat corp_phones_bak | tr - d : | tr - d 219- > noprefix Bash Shell - ansfrom bourne and korn csh/tcsh - ansfrom C shell ksh/zsh - ansfrom korn shell how shell scripts work - ansUNIX/Linux acts as an interpreter and compiles and executes in the same actprintenv - ansview list of current configuration(usually not changed) and environment (can be changed as needed) variables. You should to this before you change any Use two different commands to display the contents of the HOME variable - ansType printenv HOME and press Enter. Also, type echo $HOME and press Enter. echo ($) prints out a variable printenv views all variables, or single ones when specified printenv [-option] [variable name] - ansprints a listing of environment and configuration variables specifies one or more vars as arguments to view info only about thos to reference a variable - ansenclose in {} or precede with $ let [expression with operators] - ansperforms a given action on numbers that is specified by operators, and value is stored in a shell var PEMDAS Assign the variable t the value of 20. Next, assign the variable s the value of t+30. Finally, display the contents of t and s to verify you have correctly defined these variables. - anst= let s=t+ echo $t echo $s set [-options] [arguments] - answ no options, displays the current listing of bash environment and shell script vars set - a set - n set - o, set - o noclobber set - u set - v - ansset - a: exports all vars after defined set - n: takes commands w/o executing them set-o: sets a particular shell mode
environment to prevent you from overwriting a file - anscd set - o noclobber shell logic structures - anssequential logic decision logic looping logic case logic sequential logic - anscommands are executed in the order in which the appear in the script or program decision logic - ansexecute statement(s) according to certain conditions (if then, else) Create an alias called var that displays your environment variables. - ansalias var=" printenv" looping logic - ansfor loops At the command line use a for loop that uses the variable sandwiches and then displays a line at a time the following sandwiches: chicken, ham, hummus, tomato. - ansfor sandwiches in chicken ham hummus tomato do echo $sandwhiches done case logic - ansmatch from a list (menu) Create a script that uses case logic to have someone guess your favorite sandwich, such as tuna. - ansecho - n "Guess my favorite sandwich: " read guess case "$guess" in "tuna") echo "Tuna is my favorite sandwich" ;;
tput smso
offbold=tput rmso
- ansenables/disables boldface tput clear - ansclears the screen tput cols - ansprints number of columns for the current terminal display tput cup - anspositions cursor and text on screentput cup 0 0 : moves cursor to row 0, column 0, upper left corner sh [-options] [shell script name] - anschecks for bugs sh - n - anschecks syntax of a shell script but doesn't execute sh - v - ansdisplays lines of code whule executing a shell script sh - x - ansdisplays the command and arguments as a shell script is run login script - ansruns after you log in alias [-options] [name = "command"] - ansname that represents another command alias - p: prints all aliases trap [command] [signal number] - answhen a signal is received from the operating system, the argument included with trap is executed
List all of the signal numbers and designations for the trap command. What is the designation for signal 31? - anstrap - l 31: SIGSYS Modify your script from Exercise 17 so that there is a beep when the menu is ready to take the user's input. - ansUse the line near the end as follows: tput cup 10 9; echo - e "Select a soup ... (q) to quit \a" Is there a command that you can use to prevent shell variables from being assigned new values? If so, what is it? - ansYes. Use the readonly command in the Bash shell. Which of the following roles implement what can be classified as infrastructure services? (Choose all that apply)? a. DNS b. Web Server (IIS) c. DHCP d. Remote Desktop Services - ansa. DNS c. DHCP Which of the following is a valid upgrade path to Windows Server 2012 R2? a. Windows Server 2003 Standard to Windows Server 2012 R2 Standard b. Windows Server 2008 Standard to Windows Server 2012 R2 Standard c. Windows Server 2008 R2 32-bit to Windows Server 2012 R2 64-bit d. Windows 7 Ultimate to Windows Server 2012 R2 Essentials - ansb. Windows Server 2008 Standard to Windows Server 2012 R2 Standard Which feature must you add to a Windows Server 2012 R2 Server Core installation to convert it to the Minimal Server Interface? Graphical Management Tools and Infrastructure Server Graphical Shell Windows PowerShell Microsoft Management Console - ansGraphical Management Tools and Infrastructure What is the name of the directory where Windows stores all of the operating system modules it might need to install at a later time?
Windows System Bin WinSxS - ansWinSxS Which of the following are valid reasons why administrators might want to install their Windows Server 2012 R2 servers using the Server Core option? (Choose all that apply) A Server Core installation can be converted to the full GUI without reinstalling the operating system. The PowerShell 3.0 interface in Windows Server 2012 R2 includes more than 10 times as many cmdlets as PowerShell 2.0. The new Server Manager in Windows Server 2012 R2 makes it far easier to administer servers remotely. A Windows Server 2012 R2 Server Core license costs significantly less than a full GUI license. - ansA Server Core installation can be converted to the full GUI without reinstalling the operating system. The PowerShell 3.0 interface in Windows Server 2012 R2 includes more than 10 times as many cmdlets as PowerShell 2.0. The new Server Manager in Windows Server 2012 R2 makes it far easier to administer servers remotely. Windows Server 2012 R2 requires what processor architecture? a. 64-bit processor only b. 32-bit processor and 64-bit processor c. Any processor provided it is physical, not virtual d. Minimum dual-core processor - ansa. 64-bit processor only What are the minimum system memory requirements to run all editions of Windows Server 2012 R2? a. 256 MB RAM b. 512 MB RAM c. 2 GB RAM d. 4 GB RAM - ansb. 512 MB RAM What is the default installation of installing Windows Server 2012 R2? a. Server Core b. Startup GUI c. PowerShell