1. What is the output of the following?
x = 2
for i in range(x):
x += 1
print (x)
Correct Answer is : Peter
2. What is the output of the following?
x = 2
for i in range(x):
x -= 2
print (x)
Correct Answer is : Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )
3. What is the output of the following?
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
Correct Answer is : Array ( [0] => red [1] => green [2] => blue [3] => yellow )
4. What is the output of the following?
for i in range(5):
if i == 5:
break
else:
print(i)
else:
print("Here")
Correct Answer is : Key = Harry, Value = 21
5. What is the output of the following?
x = (i for i in range(3))
for i in x:
print(i)
Correct Answer is : I like Volvo, BMW and Toyota)
6. What is the output of the following?
x = (i for i in range(3))
for i in x:
print(i)
for i in x:
print(i)
Correct Answer is : Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )
7. What is the output of the following?
string = "my name is x"
for i in string:
print (i, end=", ")
Correct Answer is : Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )
8. What is the output of the following?
string = "my name is x"
for i in string.split():
print (i, end=", ")
Correct Answer is : Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
9. What is the output of the following?
a = [0, 1, 2, 3]
for a[-1] in a:
print(a[-1])
Correct Answer is : Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
10. What is the output of the following?
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0])
Correct Answer is : Array ( [d] => yellow )
11. What is the output of the following?
a = [0, 1, 2, 3]
i = -2
for i not in a:
print(i)
i += 1
Correct Answer is : Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
12. What is the output of the following?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
Correct Answer is : Array ( [0] => red [1] => green [2] => blue [3] => yellow )
13. The most convenient way to use R is at a graphics workstation running a ________ system.
14. Which of the following is default prompt for UNIX environment ?
Correct Answer is : Array ( [0] => red [1] => green )
15. Which of the following will start the R program ?
Correct Answer is : error
16. Which of the following statement is alternative to
?solve
Correct Answer is : rsort()
17. Elementary commands in R consist of either _______ or assignments.
Correct Answer is : Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
18. If a command is not complete at the end of a line, R will give a different prompt, by default it is :
Correct Answer is : Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
19. Command lines entered at the console are limited to about ________ bytes.
Correct Answer is : natcasesort()
20. ._____ text editor provides more general support mechanisms via ESS for working interactively with R.
Correct Answer is : Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )