Questions
Questions
a) <css>
b) <!DOCTYPE html>
c) <script>
d) <style>
2) Which of the following CSS selectors are used to specify a group of elements?
a) tag
b) id
c) class
d) both class and tag
3) Which of the following type of HTML tag is used to define an internal style sheet?
a) <script>
b) <link>
c) <class>
d) <style>
4) Which of the following is the correct syntax to link an external style sheet in the HTML file?
a) <link rel=”stylesheet” href=”style.css” />
b) <link rel=”stylesheet” src=”style.css” />
c) <style rel=”stylesheet” src=”style.css” />
d) <style rel=”stylesheet” link=”style.css” />
5)span {
border: 1px solid red;
outline: green dotted thick;
}
a) All span elements will have a green thick border and a red outline
b) All span elements will have a red border and a green dotted outline
c) All span elements will have a outer green dotted border and an inner red border
d) All span elements will have an outer red border and inner green dotted border
11) Which of the following CSS property is used to specify table borders in CSS?
a) table:border
b) table
c) border
d) none of the mentioned
12) Which of the following selector in CSS is used to select the elements that do not match the selectors?
a):! selector
b):not selector
c):empty selector
d)None of the above
14) What will be the output of the following JavaScript code snippet?
<p id="demo"></p>
var txt1 = "Sanfoundry_";
var txt2 = "Javascriptmcq";
document.getElementById("demo").innerHTML = txt1 + txt2;
a) error
b) Sanfoundry_ Javascriptmcq
c) undefined
d) Sanfoundry_Javascriptmcq
function compare()
{
let a=2;
let b=2.0;
if(a==b)
return true;
else
return false;
}
a) false
b) true
c) compilation error
d) runtime error
18) What will be the output of the following JavaScript code snippet?
int a=1;
if(a!=null)
return 1;
else
return 0;
a) 0
b) 1
c) compiler error
d) runtime error
function sanfoundry(javascript)
{
return (javascript ? “yes” : “no”);
}
bool ans=true;
console.log(sanfoundry(ans));
a) Compilation error
b) Runtime error
c) Yes
d) No
20) Which of the following methods/operation does javascript use instead of == and !=?
a) JavaScript uses equalto()
b) JavaScript uses equals() and notequals() instead
c) JavaScript uses bitwise checking
d) JavaScript uses === and !== instead
21) In the JavaScript, which one of the following is not considered as an error ________
a)Missing of semicolons
b)Syntax error
c)Division by zero
d)Missing of Bracket
<html>
<head> <title>JavaScript</title> </head>
<body bgcolor=""#0000ff"">
<script language=""JavaScript"">
<!-- document.write(""<h1> hello world </h1>""); //-->
</script>
</body>
</html>
When the above web page is loaded into a browser, what will happen?
a)The body of the web page will not contain any text
b)The body of the web page will contain the text “hello world” as an H1 heading
c)The background color of the web page will be green
d)document.write("<h1> hello world </h1 >”); is a comment.
23)The _______ method of an Array object adds and/or removes elements from an array.
a)Reverse
b)Shift
c)Slice
d)Splice
const obj1 = {
property1: 2
};
Object.seal(object);
obj1.property1 =4;
console.log(obj1.property1);
delete obj1.property1;
a)2
b)4
c)Error
d)Undefined
a)Yes
b)No
c)Runtime error
d)Compilation error
31. Which of the following methods can be used to display data in some form using Javascript?
a)document.write()
b)console.log()
c)window.alert()
d)All of the above
a)Compilation Error
b)14
c)Runtime Error
d)59
a)3, 4
b)2, 3
c)3, 4, 5
d)2, 3, 4
a)0 1 2
b)0 Undefined Undefined
c)Undefined Undefined Undefined
d)None of the above
a)YES
b)NO
c)Syntax Error
d)None of the above
a)true
b)false
c)Undefined
d)None of the above