Part I (Flowchart)
Part I (Flowchart)
CLASS-VII ( )
Session: 2023-24
Name: Date:
Part I (Flowchart)
Q. Answer the following questions:
a. Define Flowchart.
Ans :- A flowchart is a diagram depicting a process, a system or a computer algorithm. It is a diagrammatic representation
of the solution to a given problem but, more importantly, it provides a breakdown of the essential steps to solving the
problem.
Ans
Input/ Output
Processing
Decision Making
Flow Lines
Connectors
d. Complete the following flowchart:
Pass
Fail
(Note: - Students having less than 75% have not passed the exam.)
Part II (JavaScript)
Q1. Define the following terms.
a. Variables
b. Identifiers
Ans:- An identifier is simply a name. In JavaScript, identifiers are used to name variables and
Functions and to provide labels for certain loops in JavaScript code. A JavaScript identifier
must begin with a letter, an underscore ( _ ), or a dollar sign ( $ ).
c. DOM
Ans: - The Document Object Model (DOM) is a programming interface for web documents.
It represents the page so that programs can change the document structure, style, and
content. The DOM represents the document as nodes and objects; that way,
programming languages can interact with the page.
d. Loops
Ans:- Loops are used in JavaScript to perform repeated tasks based on a condition.
Conditions typically return true or false . A loop will continue running until the defined
condition returns false .
Ans:- Operators are special symbol used to assign values, compare values, perform arithmetic
operations, and many more operations
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
Conditional Operators
Ans:- == is the comparison operator. It will only return true if both values are equivalent after coercing
their types to the same type. === is a more strict comparison operator often called the
identity operator. It will only return true if both the type and value of the operands are the same.
Ans:- The remainder operator (also commonly called the modulo operator or modulus operator) is
an operator that returns the remainder after doing an integer division. For example, 7 / 4 = 1
remainder 3. Therefore, 7 % 4 = 3. As another example, 25 / 7 = 3 remainder 4, thus 25 % 7 = 4.
Q5. Name any two methods of document object model.
Ans:- getElementById()
getElementsByName()
Q6. Write all general rules for constructing names for variables.
Ans:-
Name can contain letters, digits, underscores and dollar sign
Names must begin with a letter
Names can also begin with $ and _
Names are case sensitive(y and Y are different)
Ans:- Data types in JavaScript define the data type that a variable can store. A data type is an
attribute associated with a piece of data that tells a computer system how to interpret its
value. Understanding data types ensures that data is collected in the preferred format and the value
of each property is as expected.
Q8. Find the error in the following code and rewrite the lines having error, replace with the correct code.
1. <body>
2. <form>
3. 1st Number: <input type=”text” id=”firstNumber”>
4. 2nd Number: <input type=”text” id=”secondNumber”>
5. <input type=”doc” ONClick=”multiply()” Value=”Multiply”>
6. </form>
7. <script type=”text”>
8. function mult()
9. {
10. num1 = Document.getElementById(“num1”).value;
11. num2 = Document.getElementById(“num2”).value;
12. document.getElementById(“result”).innerHTML = num1 * num2;
13. }
14. </script>
15. <p>The Result is:
16. <p id = “multiply”></>
17. </body>
Ans:-
1. <body>
2. <form>
3. 1st Number: <input type=”text” id=”firstNumber”>
4. 2nd Number: <input type=”text” id=”secondNumber”>
5. <input type=”button” onClick=”multiply()” Value=”Multiply”>
6. </form>
7. <script type=”text”>
8. function multiply ()
9. {
10. num1 = document.getElementById(“firstNumber”).value;
11. num2 = document.getElementById(“secondNumber”).value;
12. document.getElementById(“result”).innerHTML = num1 * num2;
13. }
14. </script>
15. <p>The Result is:
16. <p id = “result”></>
17. </body>