MCQOPTIONS
Saved Bookmarks
This section includes 10 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following is correct code to search in array? |
| A. | ${arr[@]/*[aA]*/} |
| B. | ${arr[#]/*[aA]*/} |
| C. | ${arr[*]/*[aA]*/} |
| D. | Both A and C |
| E. | |
| Answer» E. | |
| 2. |
Which of the following code will count Length of in Array? |
| A. | ${#arr[0]} |
| B. | ${#arr} |
| C. | ${#arr[#]} |
| D. | Both A and B |
| Answer» E. | |
| 3. |
Which of the following code is used to print elements in range? |
| A. | ${arr[@]:1:4} |
| B. | ${arr[@]} |
| C. | ${arr[*]} |
| D. | Both A and C |
| Answer» B. ${arr[@]} | |
| 4. |
Which of the following syntax is used to access all the items in an array? |
| A. | ${array_name[*]} |
| B. | ${array_name[@]} |
| C. | ${array_name[$]} |
| D. | Both A and B |
| Answer» E. | |
| 5. |
A shell variable is capable enough to hold a single value. These variables are called __________________. |
| A. | vector variables |
| B. | scalar variables |
| C. | array variables |
| D. | None of the above |
| Answer» C. array variables | |
| 6. |
what is the syntax to access array values? |
| A. | ${array_name[index]} |
| B. | #{array_name[index]} |
| C. | $${array_name[index]} |
| D. | $[array_name{index}] |
| Answer» B. #{array_name[index]} | |
| 7. |
What is the syntax of array initialization when you are using bash shell? |
| A. | array_name[index]=value |
| B. | set -A array_name value1 value2 ... Valuen |
| C. | array_name=(value1 ... valuen) |
| D. | ${array_name[index]}=value |
| Answer» D. ${array_name[index]}=value | |
| 8. |
What is the syntax of array initialization when you are using ksh shell? |
| A. | array_name[index]=value |
| B. | set -A array_name value1 value2 ... Valuen |
| C. | array_name=(value1 ... valuen) |
| D. | ${array_name[index]}=value |
| Answer» C. array_name=(value1 ... valuen) | |
| 9. |
Which of the following is correct syntax for defining array values? |
| A. | array_name{index}=value |
| B. | array_name(index)=value |
| C. | array_name[index]=value |
| D. | [index]array_name=value |
| Answer» D. [index]array_name=value | |
| 10. |
What is true about array variable in Shell? |
| A. | Shell supports a different type of variable called an array variable. |
| B. | array variable can hold multiple values at the same time. |
| C. | Arrays provide a method of grouping a set of variables |
| D. | All of the above |
| Answer» E. | |