0% found this document useful (0 votes)
3 views3 pages

Programming language Paper (2)

The document is a final term exam for a Programming Language II course, consisting of true or false questions, coding tasks, and error identification related to JavaScript and data structures. It covers topics such as adjacency matrices, half-edge data structures, and JavaScript syntax. Students are required to demonstrate their understanding of programming concepts through code writing and error correction.

Uploaded by

talhaamjadali6
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)
3 views3 pages

Programming language Paper (2)

The document is a final term exam for a Programming Language II course, consisting of true or false questions, coding tasks, and error identification related to JavaScript and data structures. It covers topics such as adjacency matrices, half-edge data structures, and JavaScript syntax. Students are required to demonstrate their understanding of programming concepts through code writing and error correction.

Uploaded by

talhaamjadali6
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/ 3

Programming language – II

(Final Term Exam)


Q1. Mark as True or False. (20)
1. A0 matrix has edges in rows and vertices in columns.
2. There are three vertices in an edge.
3. The return statement in JavaScript is used to declare a variable.
4. There are 2 Half-Edges in an edge.
5. There are 3 edges in a face.
6. The adjacency matrix (A1) of a mesh relates faces to edges.
7. /* is used to write a comment in JavaScript.
8. const is used to declare a constant.
9. Every Half-Edge has a twin.
10. The adjacency matrix (A0) contains entries that are either 0 or 1 to indicate whether a vertex is
adjacent to an edge.
11. Every half-edge in a half-edge data structure is associated with a vertex at its origin.
12. ScaleBymethod has no return command.
13. DivideBy method has return command.
14. The methods without return command do not work directly with console.log().
15. JavaScript uses the file extension .tif.
16. JavaScript uses {} to define code blocks for functions and loops.
17. You can declare a variable in JavaScript using the declare keyword.
18. Strings in JavaScript can be enclosed in either single quotes or double quotes.
19. The console.log() function is used to print output to the console in JavaScript.
20. JavaScript arrays can hold elements of only one data type.

Q2. Answer the following question.


a. Write the code for vector cross product. (3)

Q3. Answer the following questions.


a. Find the error in the following code: (3)
Normalize() {
Let n = this.norm()
this.x /= n
this.y = n
this,z /= n
}
b. Write two methods in which return and console.log() command is not used. (2)
c. Write the information that half-edge contains. (2)
Q3. Answer the following questions using the provided diagram.

a. Write A0 matrix. (5)


b. Write A1 matrix. (5)

A0
A1

You might also like