logo

Crowdly

23/24: SCC.011: The Art of Coding [1]

Шукаєте відповіді та рішення тестів для 23/24: SCC.011: The Art of Coding [1]? Перегляньте нашу велику колекцію перевірених відповідей для 23/24: SCC.011: The Art of Coding [1] в modules.lancaster.ac.uk.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

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

drawRect

which was used in creating the crossword. Using the code below which shows the

function drawRect, describe each of the function’s

parameters.

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

pattern as (in one or two words)?

[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]

Please answer all parts of the question.
Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на modules.lancaster.ac.uk?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!