题目
题目

COMM_V 205 101 102 103 2025W1 Breakout Group (BG) 8

单项选择题

Assignment in R: In R, we use arrow notation (<-) to make an assignment. An assignment defines an R object that will hold the data you specify.  For example, you type and execute x <- 30+20, R recognizes that the arrow (i.e., <-) as an assignment operator. It first evaluates the expression on the right-hand side of the arrow (30+20), which resolves to 50. Then, R creates an object named x and makes x to store the value at the right-hand side (i.e., 50).  Note that once the assignment is complete, R does not remember how x was generated. The object x only stores the value, not the expression that generated it). Suppose you executed the following lines of code (one by one). What output would be shown when the last line of code is executed? a <- 10 b <- 20/a a <- 5 b

选项
A.2
B.4
查看解析

查看解析

标准答案
Please login to view
思路分析
Question restated: In R, the assignment operator <- stores the value produced on the right-hand side into the object named on the left. Given the sequence: a <- 10; b <- 20/a; a <- 5; b, what will be printed when the last line is executed? Option 1: 2. This is the correct calculation sequence: after a <- 10, a is 10. Then b <- 20/a evaluates to 20/10, which equals 2, ......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!