0% found this document useful (0 votes)
8 views18 pages

Image and JavaScript Tool Functions

The document contains a series of true/false questions and fill-in-the-blank statements related to image editing tools, Java programming, and JavaScript concepts. It also includes comparisons between various tools in GIMP and JavaScript programming examples, demonstrating control structures like if-else and switch statements. Additionally, it provides a student performance evaluation logic based on marks and attendance.

Uploaded by

kèvïñ
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)
8 views18 pages

Image and JavaScript Tool Functions

The document contains a series of true/false questions and fill-in-the-blank statements related to image editing tools, Java programming, and JavaScript concepts. It also includes comparisons between various tools in GIMP and JavaScript programming examples, demonstrating control structures like if-else and switch statements. Additionally, it provides a student performance evaluation logic based on marks and attendance.

Uploaded by

kèvïñ
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

(TRUE OR FALSE)

The Magic Wand Tool selects areas of similar colour in an image. (True/False)​
Answer: True​

The Lasso Tool is used to make free-hand selections. (True/False)​


Answer: True​

The Rectangular Marquee Tool can be used to select circular objects. (True/False)​
Answer: False​
(You need Elliptical Marquee Tool for circles.)​

Quick Selection Tool automatically detects edges while selecting. (True/False)​


Answer: True​

Selection cannot be moved once it is made. (True/False)​


Answer: False​
(You can move a selection using the Move Tool.)​

Polygonal Lasso Tool is used to draw straight-line selections. (True/False)​


Answer: True​

Ctrl + D is used to invert a selection. (True/False)​


Answer: False​
(Ctrl + D is used to deselect. Invert is Shift + Ctrl + I.)​

You cannot edit only the selected part of an image. (True/False)​


Answer: False​

Selections can be saved for future use in many photo-editing software. (True/False)​
Answer: True​

A feathered selection creates a soft, blended edge. (True/False)​


Answer: True
he int data type in Java can store decimal values. (True/False)​
Answer: False​

The boolean data type can store only two values: true or false. (True/False)​
Answer: True​

The double data type is used for storing floating-point numbers. (True/False)​
Answer: True​

In Java, strings are stored using the String data type. (True/False)​
Answer: True​

The byte data type can store large integer values up to billions. (True/False)​
Answer: False
Fill In the blanks
Java source code is compiled by the __________.​
Answer: Java Compiler (javac)
The extension of a Java bytecode file is __________.​
Answer: .class​
The command used to run a Java program is __________.​
Answer: java​

Java is a __________ programming language.​


Answer: platform-independent​

The main() method in Java must be declared as __________.​


Answer: public static void main(String[] args)​

The keyword used to create an object in Java is __________.​


Answer: new​

A group of Java statements enclosed in braces {} is called a __________.​


Answer: block​

A variable that holds true/false values in Java is of type __________.​


Answer: boolean​

The operator used for equality comparison is __________.​


Answer: ==​

The package that contains the Scanner class is __________.​


Answer: [Link]

The area where you see all the layers in GIMP is called the __________ panel.​
Answer: Layers​

The tool used to move a layer from one place to another is the __________ tool.​
Answer: Move​

The __________ tool is used to remove unwanted outer portions of an image.​


Answer: Crop​

In GIMP, the __________ option allows you to resize an image or layer.​


Answer: Scale​

The __________ tool is used to zoom in or zoom out of the image.​


Answer: Zoom
JavaScript statements always end with a semicolon. (True/False)​
Answer: False​

JavaScript is a client-side scripting language. (True/False)​


Answer: True​

The = symbol in JavaScript is used for comparison. (True/False)​


Answer: False​
(It is used for assignment.)​

In JavaScript, 5 == "5" returns true. (True/False)​


Answer: True​
(Because == checks only value, not data type.)​
Functions in JavaScript can return values. (True/False)​
Answer: True​

JavaScript comments can only be written in one format. (True/False)​


Answer: False​
(Single-line // and multi-line /* */ exist.)​

The prompt() function is used to display a message on the webpage. (True/False)​


Answer: False​
(It is used to take input.)​

Variables declared using let can be redeclared in the same block. (True/False)​
Answer: False​

The alert() function shows a popup message to the user. (True/False)​


Answer: True​

JavaScript does not support logical operators. (True/False)​


Answer: False

Differentiate between Rotate Tool and Flip Tool (GIMP)

Rotate Tool Flip Tool

Used to rotate an image or selected Used to flip an image or layer


layer/selection by a certain angle. horizontally or vertically.

Changes the orientation but keeps the image Creates a mirror-like reflection.
upright.

Allows free rotation using handles or numeric No angle is used; only horizontal or
angle input. vertical direction is chosen.

Example: Rotating a picture by 45°. Example: Flipping a photo left-right like a


mirror.

Differentiate between Crop Tool and Scale Tool.


Crop Tool Scale Tool

Used to remove unwanted outer areas of Used to resize the image or layer.
an image.

Changes canvas size. Does not change canvas size; only the
object is scaled.

Differentiate between Move Tool and Alignment Tool.


Move Tool Alignment Tool

Used to move layers, selections, or Used to align multiple objects or layers relative to
guides. each other.
Movement is manual. Alignment is automatic based on alignment buttons.

Differentiate between Eraser Tool and Clone Tool.


Eraser Tool Clone Tool

Removes pixels to transparency or background Copies pixels from one area to


color. another.

Works like a normal eraser. Works like a brush with a source


point.

Differentiate between Rectangle Select Tool and Free Select Tool.


Rectangle Select Tool Free Select Tool

Creates rectangular selections Creates freehand or polygonal


only. selections.

Limited to straight edges. Suitable for irregular shapes.

Differentiate between Zoom Tool and Magnify Option.


Zoom Tool Magnify Option

Allows zooming in or out by clicking on Magnify option (View → Zoom) changes zoom
the canvas. level from menu.

Controlled through tool options. Controlled through predefined zoom


percentages.

Find the output


Online Shopping Discount System (Logical Operators)
let amount = parseInt(prompt("Enter purchase amount:"));

if (amount >= 5000) {


alert("Discount: 20%");
} else if (amount >= 3000 && amount < 5000) {
alert("Discount: 10%");
} else if (amount >= 1000 && amount < 3000) {
alert("Discount: 5%");
} else {
alert("No discount");
}

If amount = 3200 → ?
👉 Discount: 10%
If amount = 700 → ?
👉 No discount
4. Temperature Control System (Complex Logic)
let temp = parseInt(prompt("Enter room temperature:"));

if (temp < 16) {


alert("Too Cold");
} else if (temp >= 16 && temp <= 25) {
alert("Comfortable");
} else if (temp > 25 && temp <= 35) {
alert("Warm");
} else {
alert("Too Hot");
}

If temp = 27 → ?

👉 Warm
If temp = 12 → ?

👉 Too Cold

5. Login System (Case-sensitive + Password Length)


let username = prompt("Enter username:");
let password = prompt("Enter password:");

if (username === "Admin" && [Link] >= 6) {


alert("Login Successful");
} else {
alert("Access Denied");
}

If username = Admin, password = 123456 → ?

👉 Login Successful
If username = admin, password = 123456 → ?

👉 Access Denied​
(because JavaScript is case-sensitive)

Write a JavaScript program to check whether a number is a 3-digit even number.


Solution:

<script>

var n = parseInt(prompt("Enter a number:"));

if (n >= 100 && n <= 999 && n % 2 == 0)

alert("It is a 3-digit even number");

else

alert("Not a 3-digit even number");

</script>

2. Check whether the sum of digits is divisible by 3


Question:

Input a 3-digit number and check if the sum of its digits is divisible by 3.

Solution:

<script>

var n = parseInt(prompt("Enter 3-digit number:"));

var a = [Link](n / 100);

var b = [Link]((n / 10) % 10);

var c = n % 10;

var sum = a + b + c;

if (sum % 3 == 0)

alert("Sum of digits is divisible by 3");

else

alert("Not divisible by 3");

</script>
3. Check the largest of three numbers
Question:

Input three numbers and display the largest.

Solution:

<script>

var a = parseInt(prompt("Enter first number:"));

var b = parseInt(prompt("Enter second number:"));

var c = parseInt(prompt("Enter third number:"));

if (a > b && a > c)

alert(a + " is largest");

else if (b > c)

alert(b + " is largest");

else

alert(c + " is largest");

</script>

4. Check if a character is a vowel or consonant


Question:

Input a character; check whether it is a vowel or consonant.

Solution:

<script>

var ch = prompt("Enter a letter:");


if ("aeiouAEIOU".includes(ch))

alert("Vowel");

else

alert("Consonant");

</script>

5. Program to find the square of a number only if it is


positive
Question:

Input a number; if it is positive, display its square; else show error.

Solution:

<script>

var n = parseFloat(prompt("Enter a number:"));

if (n > 0)

alert("Square = " + n * n);

else

alert("Invalid input: number must be positive");

</script>

Convert if to switch

IF Program
<script>
var signal = prompt("Enter signal colour (red/yellow/green)");

if (signal == "red")
alert("STOP");
else if (signal == "yellow")
alert("READY");
else if (signal == "green")
alert("GO");
else
alert("Invalid input");
</script>
Switch
<script>
var signal = prompt("Enter signal colour (red/yellow/green)");

switch (signal) {
case "red":
alert("STOP");
break;

case "yellow":
alert("READY");
break;

case "green":
alert("GO");
break;

default:
alert("Invalid input");
}
</script>

2​ ​ ​ ​ ​ ​ ​ if
<script>
var choice = parseInt(prompt("1-Tea 2-Coffee 3-Juice"));

if (choice == 1)
[Link]("You selected Tea");
else if (choice == 2)
[Link]("You selected Coffee");
else if (choice == 3)
[Link]("You selected Juice");
else
[Link]("Invalid choice");
</script>

Switch
<script>
var choice = parseInt(prompt("1-Tea 2-Coffee 3-Juice"));

switch (choice) {
case 1:
[Link]("You selected Tea");
break;

case 2:
[Link]("You selected Coffee");
break;

case 3:
[Link]("You selected Juice");
break;

default:
[Link]("Invalid choice");
}
</script>

3.​ ​ ​ ​ ​ ​ ​ If
<script>
var grade = prompt("Enter grade (A/B/C/D)");

if (grade == "A")
[Link]("Excellent");
else if (grade == "B")
[Link]("Very Good");
else if (grade == "C")
[Link]("Good");
else if (grade == "D")
[Link]("Needs Improvement");
else
[Link]("Invalid Grade");
</script>

​ ​ ​ ​ ​ ​ switch
<script>
var grade = prompt("Enter grade (A/B/C/D)");

switch (grade) {
case "A":
[Link]("Excellent");
break;

case "B":
[Link]("Very Good");
break;

case "C":
[Link]("Good");
break;

case "D":
[Link]("Needs Improvement");
break;

default:
[Link]("Invalid Grade");
}
</script>
4. ​ ​ ​ ​ ​ ​ ​ If
<script>
var m = parseInt(prompt("Enter month number (1–12)"));

if (m == 1) [Link]("January");
else if (m == 2) [Link]("February");
else if (m == 3) [Link]("March");
else if (m == 4) [Link]("April");
else if (m == 5) [Link]("May");
else if (m == 6) [Link]("June");
else if (m == 7) [Link]("July");
else if (m == 8) [Link]("August");
else if (m == 9) [Link]("September");
else if (m == 10) [Link]("October");
else if (m == 11) [Link]("November");
else if (m == 12) [Link]("December");
else [Link]("Invalid month");
</script>

​ ​ ​ ​ ​ ​ switch
<script>
var m = parseInt(prompt("Enter month number (1–12)"));

switch (m) {
case 1:
[Link]("January");
break;
case 2:
[Link]("February");
break;
case 3:
[Link]("March");
break;
case 4:
[Link]("April");
break;
case 5:
[Link]("May");
break;
case 6:
[Link]("June");
break;
case 7:
[Link]("July");
break;
case 8:
[Link]("August");
break;
case 9:
[Link]("September");
break;
case 10:
[Link]("October");
break;
case 11:
[Link]("November");
break;
case 12:
[Link]("December");
break;

default:
[Link]("Invalid month");
}
</script>

5.​ ​ ​ ​ ​ ​ ​ If
<script>
var score = parseInt(prompt("Enter score (1-3):"));

if (score == 1)
alert("Science");
else if (score == 2)
alert("Commerce");
else if (score == 3)
alert("Humanities");
else
alert("Invalid Score");
</script>

​ ​ ​ ​ ​ ​ switch
<script>
var score = parseInt(prompt("Enter score (1-3):"));

switch (score) {
case 1:
alert("Science");
break;

case 2:
alert("Commerce");
break;

case 3:
alert("Humanities");
break;

default:
alert("Invalid Score");
}
</script>

6. ​ ​ ​ ​ ​ If
<script>
var item = parseInt(prompt("1-Pizza 2-Burger 3-Momos 4-Pasta"));

if (item == 1)
[Link]("Pizza - ₹200");
else if (item == 2)
[Link]("Burger - ₹80");
else if (item == 3)
[Link]("Momos - ₹70");
else if (item == 4)
[Link]("Pasta - ₹150");
else
[Link]("Invalid Selection");
</script>

​ ​ ​ ​ ​ switch
<script>
var item = parseInt(prompt("1-Pizza 2-Burger 3-Momos 4-Pasta"));

switch (item) {
case 1:
[Link]("Pizza - ₹200");
break;

case 2:
[Link]("Burger - ₹80");
break;

case 3:
[Link]("Momos - ₹70");
break;

case 4:
[Link]("Pasta - ₹150");
break;

default:
[Link]("Invalid Selection");
}
</script>

Student Performance Evaluation


Question:​
Input total marks, obtained marks, and attendance percentage.

●​ If percentage ≥ 33 and attendance ≥ 75 → “Pass”​

●​ If percentage ≥ 33 but attendance < 75 → “Pass but attendance shortage”​

●​ If percentage < 33 but attendance ≥ 75 → “Fail due to low marks”​

●​ If both are low → “Fail due to marks & attendance”​

Solution (JavaScript using prompt, alert, [Link])


<script>
var total = parseInt(prompt("Enter total marks:"));
var obtained = parseInt(prompt("Enter obtained marks:"));
var attendance = parseFloat(prompt("Enter attendance percentage:"));

var percent = (obtained / total) * 100;

if (percent >= 33 && attendance >= 75) {


alert("Pass");
[Link]("Result: Pass");
}
else if (percent >= 33 && attendance < 75) {
alert("Pass but attendance shortage");
[Link]("Result: Pass but attendance shortage");
}
else if (percent < 33 && attendance >= 75) {
alert("Fail due to low marks");
[Link]("Result: Fail due to low marks");
}
else {
alert("Fail due to marks & attendance");
[Link]("Result: Fail due to marks & attendance");
}
</script>

Grade With Grace Marks Check


Question:​
Input total marks & obtained marks.​
Rules:

●​ If percentage ≥ 90 → “A+”​

●​ ≥ 75 → “A”​

●​ ≥ 60 → “B”​

●​ ≥ 33 → “C”​

●​ < 33 →​

○​ If obtained ≥ (33% of total – 5), give 5 grace marks → “Pass with Grace”​

○​ Else → “Fail”​

Solution
<script>
var total = parseInt(prompt("Enter total marks:"));
var obtained = parseInt(prompt("Enter obtained marks:"));

var percent = (obtained / total) * 100;


var passingMarks = total * 0.33;

if (percent >= 90) {


alert("A+ Grade");
[Link]("Grade: A+");
}
else if (percent >= 75) {
alert("A Grade");
[Link]("Grade: A");
}
else if (percent >= 60) {
alert("B Grade");
[Link]("Grade: B");
}
else if (percent >= 33) {
alert("C Grade");
[Link]("Grade: C");
}
else {
if (obtained >= passingMarks - 5) {
alert("Pass with Grace");
[Link]("Result: Pass with Grace");
} else {
alert("Fail");
[Link]("Result: Fail");
}
}
</script>

3. Pass/Fail With Practical + Theory Marks


Question:​
Input:

●​ Theory marks (out of 70)​

●​ Practical marks (out of 30)​

Conditions:
●​ Theory ≥ 23 and Practical ≥ 10 → “Pass”​

●​ If theory < 23 but practical ≥ 10 → “Fail due to theory”​

●​ If theory ≥ 23 but practical < 10 → “Fail due to practical”​

●​ Both low → “Fail in both components”​

Solution

<script>
var theory = parseInt(prompt("Enter theory marks (out of 70):"));
var practical = parseInt(prompt("Enter practical marks (out of 30):"));

if (theory >= 23 && practical >= 10) {


alert("Pass");
[Link]("Result: Pass");
}
else if (theory < 23 && practical >= 10) {
alert("Fail due to low Theory marks");
[Link]("Fail due to Theory");
}
else if (theory >= 23 && practical < 10) {
alert("Fail due to low Practical marks");
[Link]("Fail due to Practical");
}
else {
alert("Fail in both Theory and Practical");
[Link]("Fail in both sections");
}
</script>

✅ 4. Scholarship Eligibility
Question:​
Input:

●​ Percentage​

●​ Annual family income​

Conditions:

●​ If percentage ≥ 85 AND income ≤ 3 lakh → “Full Scholarship”​


●​ If percentage ≥ 85 AND income ≤ 6 lakh → “Half Scholarship”​

●​ If percentage ≥ 75 → “Eligible for Merit Certificate”​

●​ Else → “Not Eligible”​

Solution

<script>
var percent = parseFloat(prompt("Enter percentage:"));
var income = parseInt(prompt("Enter family income (in lakhs):"));

if (percent >= 85 && income <= 3) {


alert("Full Scholarship");
[Link]("Award: Full Scholarship");
}
else if (percent >= 85 && income <= 6) {
alert("Half Scholarship");
[Link]("Award: Half Scholarship");
}
else if (percent >= 75) {
alert("Merit Certificate");
[Link]("Award: Merit Certificate");
}
else {
alert("Not Eligible");
[Link]("Not Eligible");
}
</scrip

Subject-Wise Pass/Fail Decision

Question:​
Input marks of 5 subjects.​
Rules:

●​ Pass only if all subjects ≥ 33​

●​ If 1 subject < 33 → “Compartment in that subject”​

●​ If 2 subjects < 33 → “Two Compartments”​

●​ If more than 2 subjects < 33 → “Fail”​

Solution

<script>
var s1 = parseInt(prompt("Enter marks of Subject 1:"));
var s2 = parseInt(prompt("Enter marks of Subject 2:"));
var s3 = parseInt(prompt("Enter marks of Subject 3:"));
var s4 = parseInt(prompt("Enter marks of Subject 4:"));
var s5 = parseInt(prompt("Enter marks of Subject 5:"));

var count = 0;

if (s1 < 33) count++;


if (s2 < 33) count++;
if (s3 < 33) count++;
if (s4 < 33) count++;
if (s5 < 33) count++;

if (count === 0) {
alert("Pass in all subjects!");
[Link]("Pass");
}
else if (count === 1) {
alert("Compartment in 1 subject");
[Link]("Compartment in one subject");
}
else if (count === 2) {
alert("Two Compartments");
[Link]("Two Compartments");
}
else {
alert("Fail");
[Link]("Fail");
}
</script>

You might also like