WorksheetsTCS693 JavaScript
Total questions: 47
Worksheet time: 26mins
JavaScript is designed for following purpose -
To Style HTML Pages
To Perform Server Side Scripting Opertion
To add interactivity to HTML Pages.
To Execute Query Related to DB on Server
The output of the below code is:
<p id="demo"></p>
<script>
var text = "";
var i;
for (i = 0; i < 5; i++) {
text += "The number is " + i + "<br>";
}
document.getElementById("demo").innerHTML = text;
</script>
The number is 0
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
The number is 0
The number is 1
The number is 2
The number is 3
The number is 4
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
Why is that person using "var"???
What is the difference between == and ===?
The === operator compares two values, without taking into account their types. == compares the values, but also makes their types into account.
Do I really need to reply this?
The == operator compares two values, without taking into account their types. === compares the values, but also makes their types into account.
The == operator is used to assign a value to a variable. === is used to compare the values of two variables.
What are HTML Tags?
HTML tags are composed of three things: an opening tag, content and ending tag. Some tags are unclosed tags.
HTML tags are composed of three things: an opening tag, content and ending tag. All tags need to be closed.
HTML tags define metadata about an HTML document. Metadata is data (information) about data.
I didn't know that I was supposed to be studying
What is the output of 10+20+"30" in JavaScript?
102030 because since there is a string, all the + will be treated as string concatenation operator (not binary +).
102030 because before you perform arithmetic operations you would have to explicitly convert those values to an actual number.
That will throw an unhandled exception, a try catch block is required to prevent it.
3030 because 10+20 will be 30. If there is numeric value before and after +, it treats as binary + (arithmetic operator).
Which of these is a loop?
if(x<10)
while(x<10)
var x=10;
text(x,10;10)
Greater than or equal to
> or =
> || =
>=
<=
What is a style sheet?
A style sheet is used to build a consistent, transportable, and well-designed style template.
To create a multicolor text on a web page
It is used to define a container for navigation links
It is used to define content aside from the content
What should a HTML web page end with?
</html>
<head>
</end>
</body>
Which tag would you use for an ordered list?
<ol>
<ul>
<li>
None of the above
Which tag would you use to insert a image?
<marquee>
< a href>
<br>
<img src>
JavaScript is designed for following purpose -
To Style HTML Pages
To Perform Server Side Scripting Opertion
To add interactivity to HTML Pages.
To Execute Query Related to DB on Server
JavaScript is an ________ language.
compiled
interpreted
Why JavaScript is called as Lightweight Programming Language ?
because JS can provide programming functionality inside but up to certain extend.
because JS is client side scripting
because JS is available free of cost.
because we can add programming functionality inside JS
JavaScript Code can be called by using _________.
RMI
Function / Method
Triggering Event
Preprocessor
Is this correct syntax to include JS Code inside HTML Page ?
<script type="text/javascript">
...
</script>
Yes
No
We cannot Place JS Code in the body tag . Say true/false.
True
False.
<script type="text/javascript">
x=4+"4";
document.write(x);
</script>
Output------?
44
8
4
Error output
Which of the following platform(s) can be used to run Javascript Code
Google Chrome
Firefox
Microsoft Edge
Safari
1.Which of the following is the correct tag to create a text box?
<input> text </input>
<text>
<input = “text”>
<input type = “text”>
What symbol should you use to target an id in css?
.
+
id
#
What symbol should you use to target a class name in css?
#
()
.
class
How do you change the font color with CSS?
font-color: green;
color: green;
change-font-color: green;
fontcolor=green;
Which of the following is NOT a part of CSS?
Property
Selector
Protocol
Value
Which of the following is NOT a type of CSS?
Inline CSS
Internal CSS
External CSS
Regular CSS
How many types of heading tags are there?
5
3
6
7
JavaScript was invented by
Brendan Eich
Tim Berners-Lee
Wium Lie
Bill Gates
Which of the following CSS is correct?
body {
background-color: lightblue;
}
body { bgcolor: lightblue;}
body { background-color: lightblue}
body { background: lightblue;}
JavaScript can be placed in
Head
Body
Both head and body
Inline
What is the DOM?
Is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types
Is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript
Is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable
The Document Object Model is a cross-platform and language-independent interface that treats an XML or HTML document as a tree structure wherein each node is an object representing a part of the document
What are the pop-up boxes types available in JavaScript?
Alert, Redirect and Prompt
Alert, Confirm and Prompt
Nice try, a pop-up can be done only using jquery or a similar library
Alert, Confirm, Redirect and Prompt
What is the use of the required attribute in HTML5?
Name: <input type="text" name="name" required>
This adds a red border over the input box for the user to visually recognize that it is required.
It forces a user to fill text on the text field or text area before submitting the form. It is used for form validation. But, the "required" attribute is not properly written in this example.
It would be nice to have that functionality, but due to browser compatibility it does not work and manual validation is required.
It forces a user to fill text on the text field or text area before submitting the form. It is used for form validation.
How to write HTML code dynamically using JavaScript?
document.getElementById('some-div-id').innerHTML="<h2>This is heading using JavaScript</h2>";
document.getElementById('some-div-id').innerHTML.val("<h2>This is heading using JavaScript</h2>";)
document.getElementById('some-div-id').innerHTML.html("<h2>This is heading using JavaScript</h2>";)
document.getElementByTagName('some-div-id').innerHTML="<h2>This is heading using JavaScript</h2>";
What attribute/value do we use to make a button execute JavaScript when clicked?
onclick="doSomething;"
on-click="doSomething;"
onclick="doSomething();"
onclick=doSomething();
