############################################################################## # Packages library(exams) library(manacc) library(tidyverse) library(knitr) library(kableExtra) library(randomNames) ############################################################################## # Initialization question_id <- "EN00000038" wdir <- getwd() parameters <- teachR::param_quest(wdir, question_id, alttype = "mcq", altlevel = "3 Apply") for (i in 1:length(parameters)) assign(names(parameters)[[i]], parameters[[i]]) options(xtable.comment = FALSE, xtable.floating = FALSE, xtable.timestamp = "") set.seed(seed) ############################################################################## # Preparation basepar <- manacc::income_statements(basevol = 20000, profitable = c(TRUE)) company <- basepar$company[[1]] product <- basepar$product[[1]] singular <- basepar$singular[[1]] plural <- basepar$plural[[1]] person <- manacc::make_persons(1) lastmonth <- lubridate::month(Sys.Date()-30, label = TRUE, abbr = FALSE) basevar <- basepar %>% dplyr::select(vol, p, uvc, fc, oi) %>% t() %>% as.data.frame() %>% rename(Budget = V1) %>% dplyr::mutate( Assumption = c("Volume","Price","Unit variable cost","Fixed costs","Operating income"), Actual = purrr::map_dbl(Budget, manacc::wiggle, delta = 0.1) ) %>% select(Assumption, Budget, Actual) basevar[5,"Actual"] <- basevar$Actual[[1]] * (basevar$Actual[[2]] - basevar$Actual[[3]]) - basevar$Actual[[4]] sbv <- basevar[5,"Actual"] - basevar[5,"Budget"] vv <- (basevar[1,"Actual"] - basevar[1,"Budget"]) * (basevar[2,"Budget"] - basevar[3,"Budget"]) fbv <- basevar[1,"Actual"] * ((basevar[2,"Actual"] - basevar[3,"Actual"]) - (basevar[2,"Budget"] - basevar[3,"Budget"])) - (basevar[4,"Actual"] - basevar[4,"Budget"]) sbv_fmt <- dplyr::case_when(sbv < 0 ~ paste0(writR::dbl(abs(sbv)), " (U)"), TRUE ~ paste0(writR::dbl(sbv), " (F)")) vv_fmt <- dplyr::case_when(vv < 0 ~ paste0(writR::dbl(abs(vv)), " (U)"), TRUE ~ paste0(writR::dbl(vv), " (F)")) fmt <- dplyr::case_when(fbv < 0 ~ " (U)", TRUE ~ " (F)") wrong_fmt <- dplyr::case_when(fbv >= 0 ~ " (U)", TRUE ~ " (F)") fbv_fmt <- paste0(writR::dbl(abs(fbv)), fmt) wrong_fbv <- c( sbv + vv, sbv - (basevar[1,"Actual"] - basevar[1,"Budget"]) * (basevar[2,"Actual"] - basevar[3,"Actual"]), sbv - (basevar[1,"Actual"] - basevar[1,"Budget"]) * (basevar[2,"Actual"] - basevar[3,"Budget"]), sbv - (basevar[1,"Actual"] - basevar[1,"Budget"]) * (basevar[2,"Budget"] - basevar[3,"Actual"]), sbv + (basevar[1,"Actual"] - basevar[1,"Budget"]) * (basevar[2,"Actual"] - basevar[3,"Actual"]), sbv + (basevar[1,"Actual"] - basevar[1,"Budget"]) * (basevar[2,"Actual"] - basevar[3,"Budget"]), sbv + (basevar[1,"Actual"] - basevar[1,"Budget"]) * (basevar[2,"Budget"] - basevar[3,"Actual"]) ) wrong_fbv <- unique(setdiff(wrong_fbv, fbv)) wrong_fbv_fmt <- c( paste0(currencysymb, writR::dbl(abs(fbv)), wrong_fmt), paste0(currencysymb, writR::dbl(abs(wrong_fbv)), fmt), paste0(currencysymb, writR::dbl(abs(wrong_fbv)), wrong_fmt) ) ############################################################################## # Answers if (reqexpl != "" & exasolu == "exam" & type_table != "html") lines <- paste0("\\vspace{",7.5,"cm}") else lines <- rep(" \\ ", 2) #lines <- rep("\\ ", 2) questions <- c(paste0(currencysymb, fbv_fmt), sample(wrong_fbv_fmt, 4)) solutions <- c(TRUE, rep(FALSE,4)) explanations <- c( "", "", "", "", "" ) ############################################################################## # Randomize order (do not edit) alea <- sample(c(1, sample(2:length(questions), (alternatives-1))), alternatives) questions <- questions[alea] solutions <- solutions[alea] explanations <- explanations[alea]
r txt_question_id
r company
buys r product
from foreign suppliers and sells them on the domestic market. In r lastmonth
, the actual operating income was r writR::dbl(basevar[5,"Actual"])
instead of the r writR::dbl(basevar[5,"Budget"])
initially budgeted. r person$first_name[[1]]
r person$last_name[[1]]
, the management accountant of the company, learned from the Chief Marketing Officer that sales people sold an actual volume of r writR::int(basevar[1,"Actual"])
r plural
for a unit selling price of r currencysymb
r writR::dbl(basevar[2,"Actual"])
. This constrasts with the r writR::int(basevar[1,"Budget"])
r plural
at a unit price of r currencysymb
r writR::dbl(basevar[2,"Budget"])
initially budgeted. Unfortunately, r person$first_name[[1]]
could not get from the purchasing manager the necessary information about the actual unit variable cost. r tools::toTitleCase(person$pronoun[[1]])
only has the budgeted unit variable cost of r writR::dbl(basevar[3,"Budget"])
. Actual and budgeted fixed costs are also missing.
\
What was the flexible budget variance in r lastmonth
? r reqexpl
r points
\
Hint: use the relationship between static budget variance, volume variance and flexible budget variance.
if (reqexpl == "") exams::answerlist(questions, markup = "markdown") else writeLines(lines)
In this situation, you do not have enough information to compute directly the flexible budget variance. Indeed, you are missing the actual unit variable costs as well as both actual and budgeted fixed costs. However, you have enough information to compute the flexible budget variance by subtracting the volume variance from the static budget variance:
$$
\begin{aligned}
\text{Static budget variance} & = \text{Actual operating income} - \text{Budgeted operating income} \
& = r writR::dbl(basevar[5,"Actual"])
- r writR::dbl(basevar[5,"Budget"])
\
& = r sbv_fmt
\
\
\text{Volume variance} & = (Q_A - Q_B) \times UCM_B \
& = (r writR::int(basevar[1,"Actual"])
- r writR::int(basevar[1,"Budget"])
) \times (r writR::dbl(basevar[2,"Budget"])
- r writR::dbl(basevar[3,"Budget"])
) \
& = r vv_fmt
\
\
\text{Flexible budget variance} & = \text{Static budget variance} - \text{Volume variance} \
& = r sbv_fmt
- r vv_fmt
\
& = r fbv_fmt
\end{aligned}
$$
Note: positive and negative variances should be penalized: variances should be absolute numbers with an indication about whether they are favorable (F) or unfavorable (U).
if (reqexpl == "") exams::answerlist(ifelse(solutions, "True", "False"), explanations, markup = "markdown") else writeLines(c("\\ ","\\ "))
extype: r extype
exsolution: r exams::mchoice2string(solutions, single = TRUE)
exname: r question_id
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.