beyond the scope of
step by step
functions
to solve or not to solve?
100

Identify a local variable:                      

let person = "mary";                          
function sayHi(name) {                      
     let greeting = "hi";                        
     console.log(greeting + " " + name);
}                                                      

sayHi(person);                                  

what is name?
or
what is greeting?

100

The definition of an algorithm

What is a set of instructions?

100

True or false: A function can have no return type.

What is true?

100

True or false, every problem only has one and only one solution.

What is false?

200

The value of count after execution

let count = 0;       
while (count<10) {
     count++;        
}                         

what is 10?

200

The building blocks of all algorithms

What is sequencing, selection, and iteration?

200

The name of the parameter in the following function:

function doSomething(peanut) {            
     let str = "hello";                      
     console.log(str + " " + peanut);
}                                                        

What is peanut?

200

A problem cannot be solved in reasonable time and must implement this to find an approximate solution.

What is a heuristic?

300

The output of the following program

let count = 0;                  
while(count<10) {            
     let sum = count+count;
}                                     
console.log(sum);              

what is nothing?

ERROR! sum is destroyed after the while loop finishes executing

300

The most important difference about the set of numbers in linear vs binary search.

What is an unsorted vs sorted list?

300

[ DAILY DOUBLE ]
The advantage of writing functions (name 2)

What are reusability, organization, and abstraction?

300

Exponential and factorial efficiency run in this time.

What is unreasonable?

400

The output of the following program:

let x = 3;                        
function getSum(y) {        
     let s = "the sum is: ";  
     console.log(s + (x+y));
}                                      
console.log(getSum(2));     

What is
<<ERROR>>
?

Can't console.log() a function with no return value!

400

The general problem:

Search for the number 3 in the following:
[4, 7, 12, 3, 5, 9]

What is searching for a number in a list?

400

A collection of functions with a related purpose.

What is a library?

400

This type of problem aims to find the "best" solution among many possibilities.

What is an optimization problem?

500

The output of the following program:

function addNums(max) {  
      count = 4;                  
      while (count < max) {  
           count++;              
           console.log(count);  
           return count;          
}                                      

console.log(addNums(5));   

What is
5
5
?

500

Ways to express an algorithm
(name one)

What is a programming language?
What is pseudocode?
What is natural language?
What is a flow chart?

500

Identify sequencing in the following code:

function calcRectVolume(l, w, h) {          
     return l * w * h;                                
}                                                            
let length = parseInt(readLine("length: ");
let width = parseInt(readLine("width: ");  
let height = parseInt(readLine("height: ");
calcVolume(length, width, height);            

what is declare values for length, width, and height before calcVolume is called with these variables as inputs?

500

The specific efficiency of the Traveling Salesman Problem.

What is factorial efficiency?