0% found this document useful (0 votes)
77 views2 pages

Practice Questions Exam 2

This document provides practice questions to help students prepare for the midterm exam in CMSC198N. It includes 31 miscellaneous questions on topics like events, event handlers, objects, and variables. It also includes 4 questions on forms and 5 questions testing functions and arrays knowledge. Students are instructed to write out JavaScript code by hand instead of using a computer in order to best prepare for the exam.

Uploaded by

Karim Hashem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views2 pages

Practice Questions Exam 2

This document provides practice questions to help students prepare for the midterm exam in CMSC198N. It includes 31 miscellaneous questions on topics like events, event handlers, objects, and variables. It also includes 4 questions on forms and 5 questions testing functions and arrays knowledge. Students are instructed to write out JavaScript code by hand instead of using a computer in order to best prepare for the exam.

Uploaded by

Karim Hashem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Midterm #3 Practice Questions, CMSC198N

These questions will help you prepare for the midterm. Solutions will not be provided; however,
you are welcome to discuss your solutions with TAs and your instructor during office hours. Do
not use a computer when writing JavaScript programs; write your solution on paper then
verify your solutions with the computer. That is the best way for you to prepare for the exam.

Miscellaneous

1. What is an event?
2. What is an event handler?
3. What is event-driven programming?
4. What is an object?
5. What is a property?
6. Mention one JavaScript object discussed in class.
7. What is a global variable?
8. Why do we want to avoid global variables?
9. What is the convention we want to follow for variable names?
10. The contents associated with a form can be sent using two methods: post and get. Describe each
method, and describe pros/cons for each one.
11. Write the web page address (http…) for a student whose directory ID is batmanrobin.
12. What does document.getElementById allow us to do?
13. What is the DOM?
14. How are the DOM and JavaScript related?
15. What does NaN stands for?
16. What functionality is associated with parseFloat?
17. What functionality is associated with parseInt?
18. What functionality is associated with Number?
19. What is a cookie?
20. What is symmetric cryptography?
21. What is asymmetric cryptography?
22. Which colors are considered cool colors?
23. What is the color wheel?
24. What is a complementary color?
25. What is an analogous color?
26. Describe two approaches to assign colors in a web page.
27. What is https?
28. What is a digital certificate?
29. Describe three major aspects associated with usability?
30. In the domain of usability, what does it mean to create predictable links?
31. What are the disadvantages associated with frames?

Forms
1. Define a text field using the <input> tag that allows us to enter the name of a person. The size of
the field is 20 characters.
2. What function can you use to retrieve the value associated with an <input> element?
3. Define a button using the <input> tag that allows us to call a function named “validate()” when the
button is clicked on.
4. What is the purpose of the “action” attribute in the <form> tag?
Functions/Arrays

1. Write a function named computeLetterGrade that has the following specifications:

Prototype: function computerLetterGrade(score)


Parameter: score is a numeric value
Processing: the function will return a string representing a letter grade according to the following
cutoffs:

score is 90 or above  “A”


score is less than 90 but higher than or equal to 80  “B”
score is less than 80 but higher than or equal to 70  “C”
other  “O”

2. Write a function named sum that has the following specifications:

Prototype: function sum(data)


Parameter: data is a one-dimensional array of integers
Processing: the function returns the sum of the values in the array

3. Write a function named maximum that has the following specifications:

Prototype: function maximum(data)


Parameter: data is a one-dimensional array of integers
Processing: the function returns the maximum value in the array.

4. Write a function named linearize that has the following specifications:

Prototype: function linearize(data)


Parameter: data is a two-dimensional array of strings
Processing: the function returns a one-dimensional array with all the elements in data. For
example, if the two-dimensional array has the following values:

“Jose”, “Mary”
“Peter”
“Rose”, “Kathy”, “Jane”

the array returned by the function will be:

“Jose”, “Mary”, “Peter”, “Rose”, “Kathy”, “Jane”

5. Exercises associated with worksheets #5 and #6.

You might also like