McqMate
These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Computer Applications (MCA) , Programming Languages .
Chapters
1. |
The commonly used UNIX commands like date, Is, cat, etc. are stored in |
A. | /dev directory |
B. | /bin and /usr/bin directories |
C. | /unixdirecotry |
D. | /tmp directory |
Answer» B. /bin and /usr/bin directories |
2. |
Which command is used to concatenate all files beginning with the string ‘emp’ and followed by non-numeric characters? |
A. | catemp{!0-9] |
B. | more [emp][!0-9] |
C. | cateemp[x-z] |
D. | catemp[a-z] |
Answer» A. catemp{!0-9] |
3. |
Which command will be used to match the pattern agarwal, Aggarwal, Agggarwal and agrawal in the file named empl.1st? |
A. | grep “[aA]99*[ar][ra]wal” empl.1st |
B. | grepag* empl.1st |
C. | cutagrawal empl.1st |
D. | grepag[ra][ar]wal empl.1st |
Answer» A. grep “[aA]99*[ar][ra]wal” empl.1st |
4. |
Which command is used to select those lines where the data lies between 7000 and 7999 at the end of the line of file empl.lit. |
A. | grep “$7…” empl.1st |
B. | grep “7…^” empl.1st |
C. | grep “7…$” empl.1st |
D. | grep ^7… empl.1st |
Answer» C. grep “7…$” empl.1st |
5. |
Which command is used to select those lines that begin with a 2 in the tre file empl.1st? |
A. | grep “^2” empl.1st |
B. | grep “2…” empl.1st |
C. | grep “7^” empl.1st |
D. | grep “2^” empl.1st |
Answer» A. grep “^2” empl.1st |
6. |
Which of the following commands is used to update access and modification times of a file? |
A. | grep |
B. | wc |
C. | touch |
D. | cat |
Answer» C. touch |
7. |
The command that can be used to restrict incoming messages to a user is |
A. | mesg |
B. | halt |
C. | grep |
D. | sleep |
Answer» A. mesg |
8. |
The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is |
A. | tee |
B. | sort |
C. | tr |
D. | grep |
Answer» C. tr |
9. |
What command is used to count the total number of lines, words, and characters contained in a file? |
A. | countw |
B. | wcount |
C. | wc |
D. | count p |
Answer» C. wc |
10. |
What command is used to remove files? |
A. | dm |
B. | rm |
C. | delete |
D. | erase |
Answer» B. rm |
11. |
What command is used with vi editor to delete a single character? |
A. | x |
B. | y |
C. | a |
D. | z |
Answer» A. x |
12. |
What command is used to save the standard output in a file, as well as display it on the terminal? |
A. | tee |
B. | grep |
C. | cat |
D. | more |
Answer» A. tee |
13. |
What command is used to count just the number of lines contained in a file? |
A. | wc –r |
B. | wc –w |
C. | wc –c |
D. | wc –l |
Answer» D. wc –l |
14. |
What command is used to sort the lines of data in a file in reverse order? |
A. | sort –r |
B. | st |
C. | sh |
D. | sort |
Answer» A. sort –r |
15. |
What shell's wild-card is used to match a single character? |
A. | [!ijk] |
B. | [ijk] |
C. | ? |
D. | * |
Answer» C. ? |
16. |
Which of the following command lists the last 10 lines of a file? |
A. | grep |
B. | tail |
C. | head |
D. | cat |
Answer» B. tail |
17. |
Which statement resumes the next iteration of a for, while, select, or untill loop? |
A. | continue |
B. | break |
C. | complete |
D. | command |
Answer» B. break |
18. |
Which command can create environment variable? |
A. | export |
B. | set |
C. | read |
D. | none of the mentioned |
Answer» D. none of the mentioned |
19. |
Which of the following is not a major Unix shell? |
A. | X Shell |
B. | C Shell |
C. | Bash Shell |
D. | Korn Shell |
Answer» C. Bash Shell |
20. |
Which was the first Unix shell? |
A. | X Shell |
B. | C Shell |
C. | Bash Shell |
D. | Korn Shell |
Answer» B. C Shell |
21. |
The purpose of the PATH variable is to |
A. | Show the current directory |
B. | Show the directory path of a file |
C. | Tells the shell what directories to search when a command is entered |
D. | Both A and C |
Answer» C. Tells the shell what directories to search when a command is entered |
22. |
What special character is used to designate the users home directory in the C shell? |
A. | @ |
B. | ~ |
C. | & |
D. | $ |
Answer» C. & |
23. |
The shell in the Unix system is the |
A. | Outer layer of a seed |
B. | User interface with the operating system |
C. | Provides a prompt |
D. | Both (b) and (c) |
Answer» A. Outer layer of a seed |
24. |
The asterisk is a meta-character which in the command "ls *.txt" means |
A. | Any single character |
B. | Any combination of one or more characters |
C. | Any combination of zero or more characters |
D. | None of the above |
Answer» A. Any single character |
25. |
Which command runs the shell built-in command ‘command’ with the given argument? |
A. | builtin |
B. | caller |
C. | there is no command present for this purpose |
D. | none of the mentioned |
Answer» A. builtin |
26. |
Which option of the command ‘cd’ use the actual filesystem path for cd..and the value of pwd? |
A. | -l |
B. | -L |
C. | -p |
D. | -P |
Answer» D. -P |
27. |
Which command generates possible completions for string according to the and write it to standard output? |
A. | compgen |
B. | complete |
C. | continue |
D. | none of the mentioned |
Answer» A. compgen |
28. |
Which command executes ‘command’ in place of the current process instead of creating a new process? |
A. | exec |
B. | command |
C. | trap |
D. | none of the mentioned |
Answer» A. exec |
29. |
Which of the following is not a iterative construct in "bash"? |
A. | If |
B. | For |
C. | Until |
D. | While |
Answer» C. Until |
30. |
Assuming the files fileA, fileB, fileAB, fileBC and fileABC, exist in a directory, which files match with the pattern file[ABC]? |
A. | fileA, fileB and fileABC |
B. | fileABC |
C. | fileA and fileB |
D. | fileAB, fileBC and fileABC |
Answer» C. fileA and fileB |
31. |
What will be printed for the command below? $ grep –c “^echo” abc |
A. | The count of lines that do not contain the pattern echo in file abc |
B. | The count of lines which begin with the pattern echo in file abc |
C. | The count of lines that ends with the pattern echo in file abc |
D. | None of the above |
Answer» B. The count of lines which begin with the pattern echo in file abc |
32. |
Which one is used to select only one copy of the repeated lines? |
A. | uniq -u |
B. | uniq -d |
C. | uniq -c |
D. | uniq –I |
Answer» A. uniq -u |
33. |
Indicate the right option to search for BOB, Bob, BOb or BoB? |
A. | grep –i Bob files |
B. | grep ‘B[oO][bB]’ files |
C. | grep ‘[BOB]’ files |
D. | grep -v ‘Bob’ files |
Answer» B. grep ‘B[oO][bB]’ files |
34. |
Indicate the right option to search for anything not a letter or number |
A. | grep ‘^[a-zA-Z0-9]’ |
B. | grep ‘[^a-zA-Z0-9]’ |
C. | grep ‘[a-zA-Z0-9]’ |
D. | None of the above |
Answer» B. grep ‘[^a-zA-Z0-9]’ |
35. |
One of the entry of /etc/passwd file is shown below: user1:x:1111:2222:McqMate:/home/user1:/bin/bash Which among the following will print userid and home dir in the following pattern “user1:/home/user1” |
A. | awk `{print $1 “:” $6}` /etc/passwd |
B. | awk `{print $1 “:” $7}` /etc/passwd |
C. | awk `{print $2 “:” $6}` /etc/passwd |
D. | awk `{print $2 “:” $7}` /etc/passwd |
Answer» A. awk `{print $1 “:” $6}` /etc/passwd |
36. |
who cut –d ” ” -f1 what is the ouput if the who command displays like this user1 tty 0 1234 |
A. | user1 |
B. | user1 tty 0 1234 |
C. | tty |
D. | tty 0 1234 |
Answer» A. user1 |
Done Studing? Take A Test.
Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.