Quiz -- RScript
# | Question | Answer | Your answer |
1 | y <- 1 k3 <- function( ) { function( ) y } y <- 4 cat("k3( )( )=",k3( )( ),"\n",sep="") # |
A 8 B 3 C 4 D 2 E -3 F -1 | |
2 | x <- 8 u <- 9 k1 <- function(x) { function( ) { x + u } } x <- 5 u <- 3 cat("k1(5)( )=",k1(5)( ),"\n",sep="") # |
A 2 B 6 C 8 D 10 E 7 F -4 | |
3 | k3 <- function(z=9) { function(u) { u - z } } cat("k3(7)(9)=",k3(7)(9),"\n") # |
A -9 B 9 C 0 D 4 E 2 | |
4 | u <- 2 y <- 4 k2 <- function(u) { function( ) { u + y } } u <- 0 y <- 7 cat("k2(0)( )=",k2(0)( ),"\n",sep="") # |
A -3 B 7 C 8 D 9 E 6 F -1 | |
5 | y <- 6 n <- function(y){ y <<- y + 3 } cat("n(4)=",n(4),'\n',sep="") # |
A 4 B 5 C 7 D -4 E -1 F 8 | |
6 | u <- 0 z <- 2 k2 <- function(z){ u <<- z + 9 u } cat("k2(6)=",k2(6),'\n',sep="") # |
A 2 B 14 C 17 D 5 E -4 F 15 | |
7 | x <- 10 k3 <- function(x) { function(x) x } x <- 7 cat("k3(x)(x)=",k3(x)(x),"\n",sep="") # |
A 7 B 5 C 6 D 9 E 11 F 2 | |
8 | x <- 0 k1 <- function( ) { x + 10 } x <- 9 cat("k1( )=",k1( ),"\n",sep="") # |
A -5 B -7 C 19 D -1 E 18 F 21 | |
9 | y <- 1 u <- 6 k1 <- function(u){ y <<- u + 2 y } cat("k1(5)=",k1(5),'\n',sep="") # |
A 7 B -8 C 6 D 4 E 3 F 5 | |
10 | x <- 2 k2 <- function(x) { x + 10 } x <- 5 cat("k2(x)=",k2(x),"\n",sep="") # |
A -8 B -6 C 15 D 17 E 14 F 8 | |
# | Question | Answer | Your answer |
11 | x <- 0 k2 <- function( ) { x + 10 } x <- 4 cat("k2( )=",k2( ),"\n",sep="") # |
A 14 B 13 C 18 D 1 E 16 F -4 | |
12 | u <- 0 y <- 3 k1 <- function(u) { u <- 2 k2 <- function(x) { x <- 4 k3 <- function(z) { z * 2 + y } k3(x) + 6 + y } k2(u) * 10 + y } cat("k1(3)=",k1(3),"\n",sep="") # |
A 0 B 205 C 204 D 207 E 203 F 1 | |
13 | x <- 2 n <- function(x){ x <<- x + 9 } cat("n(0)=",n(0),'\n',sep="") # |
A 11 B -6 C -3 D 7 E 8 F 9 | |
14 | a <- 1 k3 <- function(u) { a * u } a <- 10 k1 <- function(x) { a <- 100 k3(x) } cat("k1(3)=",k1(3),"\n",sep="") # |
A 28 B 32 C 29 D 30 E -5 F 31 | |
15 | a <- 1 k3 <- function(z) { a * z } a <- 10 k2 <- function(u) { a <- 100 k3(u) } cat("k2(3)=",k2(3),"\n",sep="") # |
A 31 B 33 C 30 D 29 E 7 F 27 | |
16 | k2 <- function(u) { k3 <- function(z) { return(u * z) } return(k3) } cat("k2(7)(9)=",k2(7)(9),"\n",sep="") # |
A 7 B -7 C 61 D 62 E 64 F 63 | |
17 | z <- 4 k2 <- function(z) { z + 5 } z <- 8 cat("k2(z)=",k2(z),"\n",sep="") # |
A 7 B 13 C 9 D 1 E 4 F 11 | |
18 | x <- 2 z <- 4 u <- 9 n <- function(y) { z <- y function(v) { x + z + v } } x <- 5 z <- 10 u <- 8 cat("n(z)(u)=",n(z)(u),"\n",sep="") # |
A -3 B -5 C 20 D 25 E 22 F 23 | |
19 | u <- 0 k3 <- function( ) { function( ) u } u <- 4 cat("k3( )( )=",k3( )( ),"\n",sep="") # |
A 4 B 6 C 3 D -9 E -10 F 1 | |
20 | y <- 5 z <- 8 u <- 0 n <- function(x) { z <- x function(v) { y + z + v } } y <- 10 z <- 4 u <- 7 cat("n(z)(u)=",n(z)(u),"\n",sep="") # |
A -2 B 21 C -4 D 20 E 24 F 23 |