Looking for 23/24: SCC.011: The Art of Coding [1] test answers and solutions? Browse our comprehensive collection of verified answers for 23/24: SCC.011: The Art of Coding [1] at modules.lancaster.ac.uk.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
The remainder of the program is missing. Write the section of code that would use the variable pattern and the function drawRect to create the crossword image shown above. Marks will be awarded for both functionality and style.
Hint: You may find the following useful:
Math.floor(number); //rounds decimal number down //i.e. if number = 5.6, //Math.floor(number) = 5
number % 8; //modulus of number, or the remainder //when divided by 8 //i.e. if number = 17, //number % 8 = 1 //(because 2*8=16 and 17-16 = 1)
You are given a second section of the program, this time revealing a function which was used in creating the crossword. Using the code below which shows the function drawRect, describe each of the function’s
Parameter Purpose
You are given the section of code below, defining three variables. Based on your knowledge of javascript, what would you describe the variable
[2 marks]
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
let pattern = [true,false,false,false,false,true,true,false,
true,false,true,true,false,true,true,false,
false,false,false,true,false,false,false,false,
true,false,true,false,true,false,true,true,
true,true,false,false,false,false,true,true,
true,false,false,false,true,false,false,false,
false,false,false,false,false,true,true,false,
false,true,true,true,false,true,true,false,
false,false,false,false,false,true,true,false];
The variable pattern is used in order to draw a crossword puzzle (see image below).
Why do you think the programmer has spread the variable over several lines?
Would this cause a problem when running the program?
Explain your reasoning.
[4 marks]
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!