CS133JS Beginning Programming: JavaScript
Topics by Week | |
---|---|
1. Intro to JavaScript programming | 6. Arrays |
2. Functions, Operators and Expressions | 7. Objects |
3. Conditional Statements: if and switch | 8. Methods |
4. Repetition: while, do while, and for | 9. DOM |
5. Midterm Check-Point | 10. Final |
Announcements and DiscussionIntroductionAbout the QuizWhat to ReviewLecture notesExample codeLab assignmentsPractice QuizProgramming PracticeSelection ProblemsFunctionsRepetitionMore Programming Practice
Are there any questions about lab 4?
The next class meeting will be just for the midterm quiz.
This week is a good time to start your term project. The term project requirements are posted on Moodle— let's take a look at those.
A proposal for your term project is due next week.
This week is your opportunity to review all that we've covered in the first four weeks of class—both as preparation for the midterm quiz as well as a way to firm up what you've learned about JavaScript so far.
Focus on understanding concepts—not on memorizing answers. The only thing to memorize is some terminology. The rest of what you need to know is how JavaScript works and how to write code.
The quiz will cover material in the lecture notes from the first four weeks of the term.
When and where to take the quiz:
In the classroom at the normal class time.
In the Instructional Testing Center Thursday, Friday or Saturday.
Bring ID.
Check the web site for the hours they are open.
For both locations:
You will have 1 hour and 50 minutes to finish the quiz.
There are 30 questions.
The quiz is restricted for IP address of the location where you take the quiz. Make sure you are connected to "LCC WiFi", not "LCC Guest".
You can bring an 8.5 x 11 inch sheet of notes which can be hand written or printed.
You are not allowed to search the internet for answers, use AI (like chatGPT) or get help from another person.
Seeing your results:
You will be able to see your score and review your answers immediately after you finish the quiz. After you exit the quiz you won't be able to review your answers again, but you will be able to see your score.
Review all the lecture notes and example code for the class, starting at week 1. If there is anything you are unsure about, copy the example code into a browser console and experiment with it. Modifying code to see what happens a great way to learn!
A good way to get a quick overview of what we covered is to look at the review section on each of the lecture notes.
Download the instructor's examples and play with the code. Put breakpoints in it, and before you run it, try to predict what will be in the variables, then run it and when it stops at the breakpoints, see if you were right. Modify the code and experiment.
Review the code you wrote for the lab assignments. Make sure you understand how everything works. If there are things you don't understand, look for answers in the required and supplemental readings, lecture notes and post questions in the Moodle Q and A forum.
There is a practice quiz available on Moodle that has the same style questions and covers the same concepts as the real quiz but using different questions. As you take the practice quiz, focus on understanding concepts, not on memorizing answers.
In order to do well on the midterm quiz and on the homework for the second half of the term, you need to understand the underlying concepts behind the questions and programming problems--not just "the answers". In order to better understand those concepts here are some more practice problems:
For each of these problems write a block of code (not a function) using a selection statement, or statements. Before writing the code, make a table showing the inputs and outputs.
A student is trying to decide which used car to buy. They want a car that meets this criteria:
Gets 35 MPG or better.
Costs less than $5,000.
Has a reliability rating of over 4 on a 1 to 5 scale.
The selection code should use the criteria above to give output of either "Buy the car", or "Don't buy the car."
You are writing code for the dice game "Pig". In this game, On a player's turn they roll a die. If the die shows any number other than 1, the number they rolled is added to their score and they can roll again, otherwise their score is set to zero and their turn ends.
The input to this block of code is the number rolled on the die as well as their current score.
The output of this block of code is their new score and whether or not they can roll again.
Write code that will determine whether each of a small set of foods are primarily a: starch, protein, fruit, or vegetable. Some possible foods are: potato, beef, beet, pinto bean, apple, asparagus, onion, tomato, tofu.
Put each of the blocks of code above into a function.
Use an appropriate loop in a new solution involving each of the problems above:
Add a loop outside the function that asks the user to enter information about another car.
a) Add a loop that will iterate again only if the player is allowed to roll again in the current turn.
b) Modify the loop so that it counts the number of rolls the player has made in their turn.
Add a loop that lets the user enter another food.
Bonus: Add a loop for input validation to any of these problems.
There are links to additional programming practice problems on Moodle:
Beginning JavaScript Lecture Notes by Brian Bird, written , revised , are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.