1.
What is the syntax for inserting the image picture.jpg?
Correct Answer
D. <img src="picture.jpg" />
Explanation
The correct syntax for inserting the image "picture.jpg" is . This syntax uses the tag and the "src" attribute to specify the source file of the image.
2.
To create a link to an anchor, you use the ______ property in A tag.
Correct Answer
D. Href
Explanation
To create a link to an anchor, you use the "href" property in the A tag. The "href" property specifies the URL of the page or the anchor to which the link should navigate. By setting the "href" attribute to the desired anchor's ID, you can create a link that takes the user directly to that specific section of the page when clicked.
3.
HTML Tags are case sensitive.
Correct Answer
A. True
Explanation
HTML tags are case sensitive, meaning that the opening and closing tags must be written in the correct case in order for them to be recognized by the browser. For example, is different from and will be treated as a different tag. This is important to keep in mind when writing HTML code to ensure that the tags are used correctly and consistently throughout the document.
4.
What does XHTML stands for?
Correct Answer
C. EXtensible Hypertext Markup Language
Explanation
XHTML stands for eXtensible Hypertext Markup Language. This is a markup language that is used to structure and format content on the web. It is an extended version of HTML, allowing for greater flexibility and compatibility with different devices and platforms. XHTML follows strict rules and guidelines, making it easier for web browsers and search engines to interpret and display web pages correctly.
5.
What is the correct HTML for referring to an external style sheet?
Correct Answer
A. <link rel="stylesheet" type="text⁄css" href="style.css" />
Explanation
The correct HTML for referring to an external style sheet is . This is because the element is used to link an external resource to an HTML document, and the rel attribute specifies the relationship between the current document and the linked resource. In this case, the rel attribute is set to "stylesheet" to indicate that the linked resource is a style sheet. The type attribute is set to "text⁄css" to specify the MIME type of the linked resource, and the href attribute is used to specify the location of the style sheet file.
6.
Which is the correct CSS syntax?
Correct Answer
A. Body {color: black}
Explanation
The correct CSS syntax is "body {color: black}". In CSS, selectors are used to target HTML elements, and in this case, the "body" selector is used to target the body element. The curly braces {} are used to enclose the declaration block, which contains the property "color" and its value "black". This syntax specifies that the text color of the body element should be black.
7.
Which of the following isn't an feature/element from HTML5?
Correct Answer
C. Close
Explanation
The "Close" element is not a feature or element from HTML5. HTML5 does not have a specific element called "Close". The other options mentioned, such as Canvas, Video, and Web Workers, are all features or elements that are part of HTML5.
8.
Whitin which element should you insert meta-tags?
Correct Answer
A. <head></head>
Explanation
Meta-tags are used to provide metadata about an HTML document. They are typically placed within the head element of an HTML document. The head element is responsible for containing meta-information about the document, such as the title, character encoding, and other important information. Placing meta-tags within the head element ensures that they are properly recognized by search engines and other web services that utilize this information. Therefore, the correct place to insert meta-tags is within the head element, as shown in the answer option.
9.
Which HTML code is correct?
Correct Answer
B. <form method = "GET" action = "send.pHp">
Explanation
The correct answer is "" because the "method" attribute specifies the HTTP method to be used when submitting the form, and "GET" is the method used to retrieve data from the server. The "action" attribute specifies the URL where the form data should be submitted.
10.
WHat is the correct doctype declaration for HTML 5?
Correct Answer
E. <!DOCTYPE html>
Explanation
The correct doctype declaration for HTML 5 is "". This declaration is used to specify the version of HTML being used in the document. In HTML 5, the doctype declaration is simplified to just "".
11.
Nu är det dags för lite Java Script! Vad kommer det att bli för output av följande kod?
(function(){
return typeof arguments;
})();
Correct Answer
B. “array”
Explanation
The code snippet is an immediately invoked function expression (IIFE) that returns the type of the "arguments" object. The "arguments" object is an array-like object that contains the arguments passed to a function. Since the "arguments" object behaves like an array, the typeof operator returns "object". However, in this specific case, the typeof operator returns "array" because the code is executed in a browser environment where the "arguments" object is automatically converted to an array-like object with additional array methods.
12.
(function(x){
delete x;
return x;
})(1);
Correct Answer
A. 1
Explanation
The given code is a self-invoking function that takes an argument 'x'. Inside the function, the 'delete' operator is used to delete the variable 'x'. However, since 'x' is a function parameter, it cannot be deleted and the 'delete' operator has no effect. The function then returns the value of 'x', which is 1. Therefore, the correct answer is 1.
13.
Var y = 1, x = y = typeof x;
x;
Correct Answer
D. “undefined”
Explanation
The code initializes the variables y and x with the value of 1. Then, it assigns the value of the typeof x to y. Since x has not been assigned any value before, its typeof is "undefined". Therefore, the value of y becomes "undefined". Finally, the code tries to access the value of x, which is also "undefined".
14.
(function f(f){
return typeof f();
})(function(){ return 1; });
Correct Answer
A. “number”
Explanation
The given code snippet is an example of a self-invoking function. It defines a function f and immediately calls it. The function f takes a parameter f, which is itself a function. Inside the self-invoking function, the typeof operator is used to determine the type of the result of calling the function f. In this case, the function f returns the number 1, so the typeof operator will return "number". Therefore, the correct answer is "number".
15.
Var foo = {
bar: function() { return this.baz; },
baz: 1
};
(function(){
return typeof arguments[0]();
})(foo.bar);
Correct Answer
A. “undefined”
Explanation
The code defines an object called "foo" with two properties: "bar" and "baz". The "bar" property is a function that returns the value of the "baz" property. The code then immediately invokes an anonymous function, passing in the "foo.bar" function as an argument. Inside the anonymous function, the "arguments[0]()" expression is called, which executes the "foo.bar" function. However, since the function is invoked without any specific context (i.e., "this" is not explicitly defined), the value of "this" inside the "bar" function will be the global object (or undefined in strict mode), and the global object does not have a "baz" property. Therefore, the expression will return "undefined".
16.
Var foo = {
bar: function(){ return this.baz; },
baz: 1
}
typeof (f = foo.bar)();
Correct Answer
A. “undefined”
Explanation
The code snippet declares an object named "foo" with two properties: "bar" and "baz". The "bar" property is a function that returns the value of the "baz" property. The "baz" property is assigned the value 1. The expression "typeof (f = foo.bar)();" assigns the function "foo.bar" to the variable "f" and immediately calls it. Since the function is called without any context, the "this" keyword inside the function refers to the global object (window in a browser). However, the global object does not have a "baz" property, so the function returns "undefined". Therefore, the correct answer is "undefined".
17.
Var f = (function f(){ return "1"; }, function g(){ return 2; })();
typeof f;
Correct Answer
B. “number”
Explanation
The code snippet defines a variable "f" that is immediately assigned the result of invoking two functions using the comma operator. The first function returns a string "1" and the second function returns the number 2. Since the comma operator evaluates each expression and returns the result of the last expression, the value assigned to "f" is 2. Therefore, the typeof "f" is "number".
18.
Var x = 1;
if (function f(){}) {
x += typeof f;
}
x;
Correct Answer
C. “1undefined”
Explanation
The code first declares a variable x and assigns it the value 1. Then, it checks if a function named f exists. Since the function f is defined within the if statement and is not called, it is considered a truthy value. As a result, the code inside the if statement is executed, which concatenates the string "undefined" to the value of x. Therefore, the final value of x is "1undefined".
19.
Var x = [typeof x, typeof y][1];
typeof typeof x;
Correct Answer
B. “string”
Explanation
The code declares a variable "x" and assigns it the value of the second element in the array [typeof x, typeof y], which is "typeof y". Since "y" is not defined, its type is "undefined". Then, the code uses the "typeof" operator twice on "x". The first "typeof" operator returns the type of "typeof y", which is a string. Therefore, the second "typeof" operator returns the type of the string, which is also a string. Hence, the answer is "string".
20.
(function(foo){
return typeof foo.bar;
})({ foo: { bar: 1 } });
Correct Answer
A. “undefined”
Explanation
The given code is an immediately-invoked function expression (IIFE) that takes an object as an argument and returns the type of the property "bar" of the object. In this case, the argument object has a property "foo" which itself has a property "bar" with a value of 1. However, when trying to access the property "bar" using "foo.bar", it returns "undefined" because "foo" does not have a property called "bar". Therefore, the correct answer is "undefined".
21.
Förklara vad DOM innebär och varför detta är så viktigt när det gäller att kombinationen mellan HTML och Java Script