Chegg – Unix Practice Exam Answers

Unix Practice Exam Answers

Enroll on Chegg

Q1. What is the objective of using the -S option with the ispell command?

  • It shows the recommended substitutions.
  • It orders the recommended substitutions from most to least likely.
  • It orders the recommended substitutions from least to most likely.
  • It saves the original file.

Q2. Which option displays disk usage and type information of a particular type of file system

  • du -t
  • df -T
  • du -T
  • df -t

Q3. Which of the following utilities belongs to the network utilities?

i. ifconfig
ii. configure
iii. whois
iv. iptables

  • (ii), (iii), (iv)
  • (i), (iii)
  • (i), (ii)
  • (i), (ii), (iii)

Q4. Suppose the script has a name testfile. Which of the following commands makes the script executable and runs it?

  • chmod +w testfile and run it using testfile
  • chmod +x testfile and run it using testfile
  • chmod +x testfile and run it using ./testfile
  • chmod r+w testfile and run it using ./testfile

Q5. The “cmp” command is executed on two files. The command displays nothing and the $ prompt appears on the terminal to execute another command. What does this mean?

  • Either one of the two files is empty
  • The compare operation failed for the two files
  • Either one of the two files does not exist
  • The two files are identical

Q6. Which of the following is the correct way to change the background of the GNOME desktop?

  • Double-click anywhere on the desktop and select the Change Desktop Background option.
  • Right-click anywhere on the desktop and select the Change Desktop Background option
  • Right-click on the blank area on the desktop and select the Change Desktop Background option
  • Double-click on the blank area on the desktop and select the Change Desktop Background option

Q7. Which of the following C++ code is used to reading a line from the text file and store it in a buffer?

  • file. getline (record_in, sizeof(record_in));
  • file.good();
  • file. fail ();
  • ifstream file(“testfile”);

Q8. Consider the below statements and pick the correct option:
Statement I: The program is stored in a subdirectory on the Web server is known as cgi-storage.
Statement II: To transmit the information to and from the websites, use INPUTTYPE=submit.

  • Statement I is true, and statement II is false
  • Both statements are false
  • Both statements are true
  • Statement I is false, and statement II is true

Q9. Select the correct option for the following line of code.

open(FILEIN, “data”) || warn “warning”;

  • It prints a “warning” if the pointer is at the end of the file
  • It returns 0 if the file is opened successfully
  • It prints a “warning” if the file’s read permissions are not set
  • It prints a “warning” if the function returns a true value

Q10. Using which of the following option, the device to back up the files can be given to the dump command?

  • Use –d option
  • The device name cannot be specified because the backup is always done on a default device
  • Use –f option
  • Use –d option

Q11. Consider the following C++ code:

  • The given code writes the sentences contained in the buffer to the file “textfile”
  • The given code reads the content of the “textfile”.
  • The given code reads the content of the “textfile” and prints all the lines contained in the “textfile”.
  • The given code reads the content of the “textfile” and prints the alternate lines of the “textfile”

Q12. Which of the following statements are true according to the given code:

tput cup 16 1; read name
until test “$name” = “?”
do
tput cup 15 1; echo “Do you want to quit(q): “
tput cup 15 1; read option
if test “$option” = “q”
then
clear
exit
fi
tput cup 16 1; read name
done


i. The tput cup statement set the cursor to the specified location
ii. The cursor will reposition to line 15 if the name is ?
iii. The code snippet is repeated until the user input for the option field is q
iv. Until loop repeats as long as the user input ?

  • (i), (ii), (iii), (iv)
  • (i), (ii), (iii)
  • (i), (ii), (iv)
  • (i) (ii)

Q13. Identify the instruction to call structure type print() function in the given code:

# include
# include
using namespace std;
void print(const struct tm *temp) { ……. }
void print(const time_t *temp) { ……. }
void main()
{
time_t t;
struct tm*timer;
time(&t);
timer = localtime(&t);
}

  • print (timer);
  • print (*timer);
  • print (&timer);
  • print ();

Q14. Following are the few passwords created for the Unix system:

i. JAMES1880

ii. [email protected]

iii. MaRy2112

iv. JoHx!9910

v. MiwSjaE!0991

Choose the correct passwords listed above.

  • i, ii
  • iii, iv
  • ii, iv
  • ii, v

Q15. What is the largest font size heading tag for creating a webpage?

Q16. In bash shell, a command-line is started from within the vi editor. Which of the following script runs?

  • .bash_logout script
  • .bashrc script
  • Both ( .bash_profile script ) and ( .bash_logout script )
  • .bash_profile script

Q17. Which will create a script shell in UNIX/Linux?

  • #!/bin/shecho ABC
  • #/bin/shecho ABC
  • &!/bin/shecho ABC
  • $!/bin/shecho ABC

Q18. Consider the following piece of code in C++.

void display (int x) {
cout << ” Integer value: ” << x;
}
void display (double f) {
cout << ” Float value: ” << f;
}
int main () {
display (5);
display (5.5);
return 0;
}

Which of the following concept implements this functionality of the code?

  • Function overloading
  • Destructor overloading
  • Inheritance
  • Operator overloading

Q19. Which of the following provides a secure way to connect to the remote server?

  • None
  • Telnet
  • SSH
  • Both (SSH) and (Telnet)

Q20. Identify the true statement from the below options:

  • Shell variables cannot be used to clear the screen
  • Clearing a screen using a shell variable or clear command takes equal time
  • Clearing a screen using clear command is a faster operation than using a shell variable
  • Clearing a screen using a shell variable is faster because it takes time to locate clear command and execute it
Conclusion:

I hope this Unix Practice Exam Answers would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.