Podcast
Questions and Answers
What is the result of calling toCelsius(32)?
What is the result of calling toCelsius(32)?
What happens if you use toCelsius without parentheses?
What happens if you use toCelsius without parentheses?
Which statement accurately describes local variables in JavaScript?
Which statement accurately describes local variables in JavaScript?
What is the main purpose of JavaScript objects?
What is the main purpose of JavaScript objects?
Signup and view all the answers
What is a characteristic of global variables?
What is a characteristic of global variables?
Signup and view all the answers
What will happen if a value is assigned to an undeclared variable?
What will happen if a value is assigned to an undeclared variable?
Signup and view all the answers
What is the scope of variables defined within a function?
What is the scope of variables defined within a function?
Signup and view all the answers
How can functions be utilized in JavaScript?
How can functions be utilized in JavaScript?
Signup and view all the answers
What will be the value of z after executing var x = 5 + 2 + 3; var y = 2; var z = x + y;
What will be the value of z after executing var x = 5 + 2 + 3; var y = 2; var z = x + y;
Signup and view all the answers
What happens when you add a number and a string in JavaScript?
What happens when you add a number and a string in JavaScript?
Signup and view all the answers
Which statement correctly defines a JavaScript function?
Which statement correctly defines a JavaScript function?
Signup and view all the answers
When is the code inside a JavaScript function executed?
When is the code inside a JavaScript function executed?
Signup and view all the answers
Which of the following statements about the += operator in JavaScript is accurate?
Which of the following statements about the += operator in JavaScript is accurate?
Signup and view all the answers
What is not a reason for using functions in JavaScript?
What is not a reason for using functions in JavaScript?
Signup and view all the answers
How are function parameters different from function arguments?
How are function parameters different from function arguments?
Signup and view all the answers
What will the result be when executing the statement y = '5' + 5?
What will the result be when executing the statement y = '5' + 5?
Signup and view all the answers
Which method can be used to break up a long string safely in JavaScript?
Which method can be used to break up a long string safely in JavaScript?
Signup and view all the answers
What will the result of the expression (x == y) be if x is a string and y is a String object?
What will the result of the expression (x == y) be if x is a string and y is a String object?
Signup and view all the answers
How does the === operator differ from the == operator in JavaScript?
How does the === operator differ from the == operator in JavaScript?
Signup and view all the answers
What type will the variable 'x' have when assigned using var x = ‘Mike’?
What type will the variable 'x' have when assigned using var x = ‘Mike’?
Signup and view all the answers
What will happen if you attempt to split a line using a backslash in JavaScript code?
What will happen if you attempt to split a line using a backslash in JavaScript code?
Signup and view all the answers
What is the correct way to represent the number 12300000 in JavaScript?
What is the correct way to represent the number 12300000 in JavaScript?
Signup and view all the answers
How is the maximum number of decimal digits that JavaScript can accurately represent classified?
How is the maximum number of decimal digits that JavaScript can accurately represent classified?
Signup and view all the answers
Which of the following statements is true about primitive strings in JavaScript?
Which of the following statements is true about primitive strings in JavaScript?
Signup and view all the answers
What will typeof return for a string defined as an object using 'new String()'?
What will typeof return for a string defined as an object using 'new String()'?
Signup and view all the answers
What will the value of 'x' be after executing 'var x = 0.2 + 0.1;'?
What will the value of 'x' be after executing 'var x = 0.2 + 0.1;'?
Signup and view all the answers
What is the result of dividing a number by zero in JavaScript?
What is the result of dividing a number by zero in JavaScript?
Signup and view all the answers
Which statement is accurate regarding how JavaScript treats numbers?
Which statement is accurate regarding how JavaScript treats numbers?
Signup and view all the answers
What does 'NaN' represent in JavaScript?
What does 'NaN' represent in JavaScript?
Signup and view all the answers
How are hexadecimal numeric constants denoted in JavaScript?
How are hexadecimal numeric constants denoted in JavaScript?
Signup and view all the answers
What is the main format in which JavaScript stores all numbers?
What is the main format in which JavaScript stores all numbers?
Signup and view all the answers
What type of value does 'typeof Infinity' return in JavaScript?
What type of value does 'typeof Infinity' return in JavaScript?
Signup and view all the answers
What will be the length of the array after adding 'Lemon' to the fruits array?
What will be the length of the array after adding 'Lemon' to the fruits array?
Signup and view all the answers
What kind of indexes does JavaScript arrays use?
What kind of indexes does JavaScript arrays use?
Signup and view all the answers
Which of the following statements about JavaScript's associative arrays is correct?
Which of the following statements about JavaScript's associative arrays is correct?
Signup and view all the answers
What will be the output of the variable 'y' after the following code executes: var person = []; person = 'Adil'; person = 'Anwar'; person = 46; var y = person;
What will be the output of the variable 'y' after the following code executes: var person = []; person = 'Adil'; person = 'Anwar'; person = 46; var y = person;
Signup and view all the answers
Which of the following is NOT a reason to avoid using the 'new Array()' statement?
Which of the following is NOT a reason to avoid using the 'new Array()' statement?
Signup and view all the answers
Which method is recommended to add a new element to an array in JavaScript?
Which method is recommended to add a new element to an array in JavaScript?
Signup and view all the answers
What is the correct way to create an empty array in JavaScript?
What is the correct way to create an empty array in JavaScript?
Signup and view all the answers
Which loop is best suited for iterating through an array in JavaScript?
Which loop is best suited for iterating through an array in JavaScript?
Signup and view all the answers
What will the value of z be after executing var x = 5 + 2 + 3; var y = 2; var z = x + y;
What will the value of z be after executing var x = 5 + 2 + 3; var y = 2; var z = x + y;
Signup and view all the answers
What is the primary purpose of the return statement in a JavaScript function?
What is the primary purpose of the return statement in a JavaScript function?
Signup and view all the answers
Which operator can be used to concatenate two strings in JavaScript?
Which operator can be used to concatenate two strings in JavaScript?
Signup and view all the answers
What will be the result when a number and a string are added in JavaScript?
What will be the result when a number and a string are added in JavaScript?
Signup and view all the answers
Which of the following would result in a valid function definition?
Which of the following would result in a valid function definition?
Signup and view all the answers
How can you add a value to an existing string variable in JavaScript?
How can you add a value to an existing string variable in JavaScript?
Signup and view all the answers
What does the 'function invocation' refer to in JavaScript?
What does the 'function invocation' refer to in JavaScript?
Signup and view all the answers
Which of the following statements about variables in JavaScript is true?
Which of the following statements about variables in JavaScript is true?
Signup and view all the answers
What will happen if a line of code in JavaScript starts with a comment?
What will happen if a line of code in JavaScript starts with a comment?
Signup and view all the answers
Which of the following is a true statement regarding the case sensitivity of JavaScript identifiers?
Which of the following is a true statement regarding the case sensitivity of JavaScript identifiers?
Signup and view all the answers
What is the commonly accepted format for variable naming in JavaScript when using multiple words?
What is the commonly accepted format for variable naming in JavaScript when using multiple words?
Signup and view all the answers
How are multiple statements handled in a single line in JavaScript?
How are multiple statements handled in a single line in JavaScript?
Signup and view all the answers
What is the role of Unicode in JavaScript?
What is the role of Unicode in JavaScript?
Signup and view all the answers
What is the purpose of a semicolon in a JavaScript statement?
What is the purpose of a semicolon in a JavaScript statement?
Signup and view all the answers
How does JavaScript interpret white space in code?
How does JavaScript interpret white space in code?
Signup and view all the answers
What is generally recommended regarding line length for better readability in JavaScript?
What is generally recommended regarding line length for better readability in JavaScript?
Signup and view all the answers
What is the default date representation when using new Date() with no parameters?
What is the default date representation when using new Date() with no parameters?
Signup and view all the answers
Which method correctly converts a date to a UTC string?
Which method correctly converts a date to a UTC string?
Signup and view all the answers
When creating a Date object to represent 'October 13, 2014 11:13:00', which syntax is correct?
When creating a Date object to represent 'October 13, 2014 11:13:00', which syntax is correct?
Signup and view all the answers
What does the zero time reference in JavaScript correspond to?
What does the zero time reference in JavaScript correspond to?
Signup and view all the answers
Which statement about the use of new Date(milliseconds) is accurate?
Which statement about the use of new Date(milliseconds) is accurate?
Signup and view all the answers
When using new Date(year, month, day), what is the range of the month value?
When using new Date(year, month, day), what is the range of the month value?
Signup and view all the answers
What will the following code output? 'var d = new Date(86400000); document.getElementById("demo").innerHTML = d;'
What will the following code output? 'var d = new Date(86400000); document.getElementById("demo").innerHTML = d;'
Signup and view all the answers
Which of the following is NOT an allowable parameter when creating a Date object using new Date(year, month, day, hours, minutes, seconds, milliseconds)?
Which of the following is NOT an allowable parameter when creating a Date object using new Date(year, month, day, hours, minutes, seconds, milliseconds)?
Signup and view all the answers
What will the result of evaluating 100 / 'Apple' be in JavaScript?
What will the result of evaluating 100 / 'Apple' be in JavaScript?
Signup and view all the answers
When comparing two number objects using the == operator, what will be the result?
When comparing two number objects using the == operator, what will be the result?
Signup and view all the answers
What happens when you use the === operator to compare a primitive number and a number object?
What happens when you use the === operator to compare a primitive number and a number object?
Signup and view all the answers
Which of the following statements is true regarding JavaScript number methods?
Which of the following statements is true regarding JavaScript number methods?
Signup and view all the answers
What is the main purpose of code blocks in JavaScript?
What is the main purpose of code blocks in JavaScript?
Signup and view all the answers
Which of the following is true about JavaScript comments?
Which of the following is true about JavaScript comments?
Signup and view all the answers
Which method will convert a number to a string representation in JavaScript?
Which method will convert a number to a string representation in JavaScript?
Signup and view all the answers
If you create a number as an object using new Number(500), what type will it be?
If you create a number as an object using new Number(500), what type will it be?
Signup and view all the answers
Which of these statements about JavaScript identifiers is correct?
Which of these statements about JavaScript identifiers is correct?
Signup and view all the answers
What does the equal sign (=) represent in JavaScript?
What does the equal sign (=) represent in JavaScript?
Signup and view all the answers
What does the isNaN() function return when applied to a variable that holds a numerical division by a string that cannot be converted to a number?
What does the isNaN() function return when applied to a variable that holds a numerical division by a string that cannot be converted to a number?
Signup and view all the answers
What will be the result of comparing (new Number(500) == new Number(500))?
What will be the result of comparing (new Number(500) == new Number(500))?
Signup and view all the answers
Where is the best place to break a long JavaScript statement?
Where is the best place to break a long JavaScript statement?
Signup and view all the answers
What will happen when you use comments to prevent code execution?
What will happen when you use comments to prevent code execution?
Signup and view all the answers
Which of the following accurately describes JavaScript variables?
Which of the following accurately describes JavaScript variables?
Signup and view all the answers
Which statement is NOT true about multi-line comments in JavaScript?
Which statement is NOT true about multi-line comments in JavaScript?
Signup and view all the answers
When are local variables deleted in JavaScript?
When are local variables deleted in JavaScript?
Signup and view all the answers
What happens to global variables when the page is closed?
What happens to global variables when the page is closed?
Signup and view all the answers
Which object represents the global scope in an HTML document?
Which object represents the global scope in an HTML document?
Signup and view all the answers
Which of the following correctly exemplifies a JavaScript string?
Which of the following correctly exemplifies a JavaScript string?
Signup and view all the answers
What is an example of an HTML event that JavaScript can respond to?
What is an example of an HTML event that JavaScript can respond to?
Signup and view all the answers
When using quotes inside a string, what rule should be followed?
When using quotes inside a string, what rule should be followed?
Signup and view all the answers
How can JavaScript code be executed when an event occurs?
How can JavaScript code be executed when an event occurs?
Signup and view all the answers
Which statement is true about function arguments in JavaScript?
Which statement is true about function arguments in JavaScript?
Signup and view all the answers
What will be the value of 'txt3' after executing the following JavaScript code: var txt1 = 'John'; var txt2 = 'Doe'; var txt3 = txt1 + ' ' + txt2;
What will be the value of 'txt3' after executing the following JavaScript code: var txt1 = 'John'; var txt2 = 'Doe'; var txt3 = txt1 + ' ' + txt2;
Signup and view all the answers
Which operator would you use to append a string to an existing variable in JavaScript?
Which operator would you use to append a string to an existing variable in JavaScript?
Signup and view all the answers
What is the maximum number of accurate decimal digits that JavaScript can represent with floating-point arithmetic?
What is the maximum number of accurate decimal digits that JavaScript can represent with floating-point arithmetic?
Signup and view all the answers
What is the correct way to define a function in JavaScript?
What is the correct way to define a function in JavaScript?
Signup and view all the answers
When a number exceeds the largest possible value in JavaScript, what value is returned?
When a number exceeds the largest possible value in JavaScript, what value is returned?
Signup and view all the answers
What will be the output of the variable 'y' after executing the following code: var x = '5' + 5;
What will be the output of the variable 'y' after executing the following code: var x = '5' + 5;
Signup and view all the answers
How is a hexadecimal number represented in JavaScript?
How is a hexadecimal number represented in JavaScript?
Signup and view all the answers
When is a JavaScript function invoked?
When is a JavaScript function invoked?
Signup and view all the answers
What will be the value of the variable 'carName' after the declaration 'var carName;'?
What will be the value of the variable 'carName' after the declaration 'var carName;'?
Signup and view all the answers
What happens when a return statement is reached in a JavaScript function?
What happens when a return statement is reached in a JavaScript function?
Signup and view all the answers
Which of the following correctly demonstrates variable declaration and assignment in one statement?
Which of the following correctly demonstrates variable declaration and assignment in one statement?
Signup and view all the answers
Which of the following statements about numbers in JavaScript is accurate?
Which of the following statements about numbers in JavaScript is accurate?
Signup and view all the answers
What is the result of the operation 0.2 + 0.1 in JavaScript?
What is the result of the operation 0.2 + 0.1 in JavaScript?
Signup and view all the answers
What does the variable 'anum' hold in the statement 'var anum = '3.14';'?
What does the variable 'anum' hold in the statement 'var anum = '3.14';'?
Signup and view all the answers
In JavaScript, what type will the variable 'z' have after executing var z = 5 + '5';?
In JavaScript, what type will the variable 'z' have after executing var z = 5 + '5';?
Signup and view all the answers
What will the type of NaN evaluate to when using typeof in JavaScript?
What will the type of NaN evaluate to when using typeof in JavaScript?
Signup and view all the answers
Which best describes the use of parameters in a JavaScript function?
Which best describes the use of parameters in a JavaScript function?
Signup and view all the answers
How can multiple variables be declared in a single statement?
How can multiple variables be declared in a single statement?
Signup and view all the answers
What happens if you re-declare a JavaScript variable?
What happens if you re-declare a JavaScript variable?
Signup and view all the answers
Which of the following operations will result in NaN?
Which of the following operations will result in NaN?
Signup and view all the answers
What does the expression '123e5' represent in JavaScript?
What does the expression '123e5' represent in JavaScript?
Signup and view all the answers
Which of the following is true about strings in JavaScript?
Which of the following is true about strings in JavaScript?
Signup and view all the answers
What is the initial value of a variable declared with 'var varName;'?
What is the initial value of a variable declared with 'var varName;'?
Signup and view all the answers
What is the effect of surrounding a number with quotes in JavaScript?
What is the effect of surrounding a number with quotes in JavaScript?
Signup and view all the answers
What method should be used to set the year in a JavaScript date object?
What method should be used to set the year in a JavaScript date object?
Signup and view all the answers
What does the Date.parse() method return?
What does the Date.parse() method return?
Signup and view all the answers
Which comparison operator is used to check if one date object is later than another?
Which comparison operator is used to check if one date object is later than another?
Signup and view all the answers
How can you access the first element in an array declared as var cars = ['Toyota', 'Honda', 'BMW'];?
How can you access the first element in an array declared as var cars = ['Toyota', 'Honda', 'BMW'];?
Signup and view all the answers
Which method allows you to set the hour of a date object in JavaScript?
Which method allows you to set the hour of a date object in JavaScript?
Signup and view all the answers
What is the purpose of using arrays in JavaScript?
What is the purpose of using arrays in JavaScript?
Signup and view all the answers
When using setDate() to add 4 days to the current date, what do you first retrieve?
When using setDate() to add 4 days to the current date, what do you first retrieve?
Signup and view all the answers
If you wanted to convert a string date into a date object, which approach could you use?
If you wanted to convert a string date into a date object, which approach could you use?
Signup and view all the answers
What is the benefit of closing all HTML elements?
What is the benefit of closing all HTML elements?
Signup and view all the answers
Which statement is true regarding HTML tags and case sensitivity?
Which statement is true regarding HTML tags and case sensitivity?
Signup and view all the answers
What is a requirement for specifying attributes in HTML?
What is a requirement for specifying attributes in HTML?
Signup and view all the answers
Why is it important to declare a language in HTML?
Why is it important to declare a language in HTML?
Signup and view all the answers
What does the 'href' attribute represent in an HTML link?
What does the 'href' attribute represent in an HTML link?
Signup and view all the answers
What do single or double quotes around attribute values provide?
What do single or double quotes around attribute values provide?
Signup and view all the answers
What is the recommended practice regarding HTML attribute names?
What is the recommended practice regarding HTML attribute names?
Signup and view all the answers
Which statement about the title attribute in HTML is correct?
Which statement about the title attribute in HTML is correct?
Signup and view all the answers
What does URL encoding do to unsafe ASCII characters?
What does URL encoding do to unsafe ASCII characters?
Signup and view all the answers
Which HTTP method is primarily used for submitting data to be processed?
Which HTTP method is primarily used for submitting data to be processed?
Signup and view all the answers
What distinguishes HTTPS from HTTP?
What distinguishes HTTPS from HTTP?
Signup and view all the answers
What is the primary role of a web server?
What is the primary role of a web server?
Signup and view all the answers
Which statement accurately describes a web service?
Which statement accurately describes a web service?
Signup and view all the answers
What is the purpose of a domain name?
What is the purpose of a domain name?
Signup and view all the answers
In a client-server model, what does an application server do?
In a client-server model, what does an application server do?
Signup and view all the answers
Which character is commonly used to replace spaces in URLs?
Which character is commonly used to replace spaces in URLs?
Signup and view all the answers
Where is the best place to break a JavaScript statement that does not fit on one line?
Where is the best place to break a JavaScript statement that does not fit on one line?
Signup and view all the answers
What is the primary purpose of code blocks in JavaScript?
What is the primary purpose of code blocks in JavaScript?
Signup and view all the answers
Which of the following rules is NOT true for valid JavaScript identifiers?
Which of the following rules is NOT true for valid JavaScript identifiers?
Signup and view all the answers
What does adding '//' in front of a code line accomplish in JavaScript?
What does adding '//' in front of a code line accomplish in JavaScript?
Signup and view all the answers
What represents the assignment operator in JavaScript?
What represents the assignment operator in JavaScript?
Signup and view all the answers
Why are comments useful in JavaScript code?
Why are comments useful in JavaScript code?
Signup and view all the answers
Which type of comment allows for multiple lines in JavaScript?
Which type of comment allows for multiple lines in JavaScript?
Signup and view all the answers
Which statement about JavaScript variables is true?
Which statement about JavaScript variables is true?
Signup and view all the answers
Why are comments considered beneficial in HTML?
Why are comments considered beneficial in HTML?
Signup and view all the answers
What is the purpose of the alt attribute in HTML?
What is the purpose of the alt attribute in HTML?
Signup and view all the answers
In HTML, how can images be utilized as links?
In HTML, how can images be utilized as links?
Signup and view all the answers
What will be the value of a variable that is declared but not initialized?
What will be the value of a variable that is declared but not initialized?
Signup and view all the answers
When is it appropriate to use single quotes in HTML attributes?
When is it appropriate to use single quotes in HTML attributes?
Signup and view all the answers
What are conditional comments used for in HTML?
What are conditional comments used for in HTML?
Signup and view all the answers
Which of the following correctly declares multiple variables in one statement?
Which of the following correctly declares multiple variables in one statement?
Signup and view all the answers
What data type is represented by the value '3.14' when written with quotes?
What data type is represented by the value '3.14' when written with quotes?
Signup and view all the answers
What role do screen readers play in web accessibility?
What role do screen readers play in web accessibility?
Signup and view all the answers
When defining a hyperlink in HTML, which tag is crucial?
When defining a hyperlink in HTML, which tag is crucial?
Signup and view all the answers
Which statement is true about re-declaring a variable in JavaScript?
Which statement is true about re-declaring a variable in JavaScript?
Signup and view all the answers
What is the correct way to assign a value to a declared variable, carName?
What is the correct way to assign a value to a declared variable, carName?
Signup and view all the answers
What is a potential disadvantage of leaving HTML comments in production code?
What is a potential disadvantage of leaving HTML comments in production code?
Signup and view all the answers
When a number is treated as a string due to quotes, what will happen in an arithmetic operation?
When a number is treated as a string due to quotes, what will happen in an arithmetic operation?
Signup and view all the answers
Which keyword is used to declare a variable in JavaScript?
Which keyword is used to declare a variable in JavaScript?
Signup and view all the answers
What will be the output of 'console.log(carName)' if carName was declared but not initialized?
What will be the output of 'console.log(carName)' if carName was declared but not initialized?
Signup and view all the answers
What character is used in JavaScript to avoid confusion with special characters in strings?
What character is used in JavaScript to avoid confusion with special characters in strings?
Signup and view all the answers
When splitting a long line of code for better readability, where is it best to break the line?
When splitting a long line of code for better readability, where is it best to break the line?
Signup and view all the answers
How can a string that contains both single and double quotes be correctly represented in JavaScript?
How can a string that contains both single and double quotes be correctly represented in JavaScript?
Signup and view all the answers
What will the length of the string 'We are the so-called "Vikings" from the north.' be in JavaScript?
What will the length of the string 'We are the so-called "Vikings" from the north.' be in JavaScript?
Signup and view all the answers
Which statement is accurate regarding the representation of special characters in strings?
Which statement is accurate regarding the representation of special characters in strings?
Signup and view all the answers
What does the Top Level Domain (TLD) in a domain name identify?
What does the Top Level Domain (TLD) in a domain name identify?
Signup and view all the answers
What is the primary function of the File Transfer Protocol (FTP)?
What is the primary function of the File Transfer Protocol (FTP)?
Signup and view all the answers
What role does an FTP client serve in file transfer?
What role does an FTP client serve in file transfer?
Signup and view all the answers
Which of the following statements about HTML is accurate?
Which of the following statements about HTML is accurate?
Signup and view all the answers
Which statement correctly describes the role of semicolons in JavaScript?
Which statement correctly describes the role of semicolons in JavaScript?
Signup and view all the answers
What is the purpose of having a domain name mapped to an IP address?
What is the purpose of having a domain name mapped to an IP address?
Signup and view all the answers
Which part of a domain name is considered the Third Level Domain or Sub Domain?
Which part of a domain name is considered the Third Level Domain or Sub Domain?
Signup and view all the answers
What happens when multiple spaces are used in JavaScript code?
What happens when multiple spaces are used in JavaScript code?
Signup and view all the answers
What does the acronym ICANN represent in the context of domain name registration?
What does the acronym ICANN represent in the context of domain name registration?
Signup and view all the answers
Which of these statements about JavaScript identifiers is true?
Which of these statements about JavaScript identifiers is true?
Signup and view all the answers
Which example demonstrates proper camel case variable naming?
Which example demonstrates proper camel case variable naming?
Signup and view all the answers
Which of the following is NOT a component of a domain name?
Which of the following is NOT a component of a domain name?
Signup and view all the answers
What is the primary purpose of a JavaScript statement?
What is the primary purpose of a JavaScript statement?
Signup and view all the answers
How is the Unicode character set relevant to JavaScript?
How is the Unicode character set relevant to JavaScript?
Signup and view all the answers
Which method can be used to improve the readability of a JavaScript script?
Which method can be used to improve the readability of a JavaScript script?
Signup and view all the answers
What is the recommended maximum line length for JavaScript code to ensure best readability?
What is the recommended maximum line length for JavaScript code to ensure best readability?
Signup and view all the answers
What is the result of using the === operator to compare a primitive string and a String object in JavaScript?
What is the result of using the === operator to compare a primitive string and a String object in JavaScript?
Signup and view all the answers
Which method is typically considered safest for breaking up a long string in JavaScript?
Which method is typically considered safest for breaking up a long string in JavaScript?
Signup and view all the answers
How does JavaScript treat primitive values when executing methods and properties?
How does JavaScript treat primitive values when executing methods and properties?
Signup and view all the answers
In JavaScript, which statement correctly describes the execution of a code line that attempts to break up using a backslash?
In JavaScript, which statement correctly describes the execution of a code line that attempts to break up using a backslash?
Signup and view all the answers
What will the type of variable 'y' be after executing var y = new String('Mike');?
What will the type of variable 'y' be after executing var y = new String('Mike');?
Signup and view all the answers
Which of the following accurately describes primitive strings in JavaScript?
Which of the following accurately describes primitive strings in JavaScript?
Signup and view all the answers
When comparing two strings in JavaScript using the == operator, what is important?
When comparing two strings in JavaScript using the == operator, what is important?
Signup and view all the answers
Which of the following statements is true regarding string literals and String objects in JavaScript?
Which of the following statements is true regarding string literals and String objects in JavaScript?
Signup and view all the answers
What happens when you perform an operation that exceeds the maximum representable number in JavaScript?
What happens when you perform an operation that exceeds the maximum representable number in JavaScript?
Signup and view all the answers
Which of the following represents a number in scientific notation correctly?
Which of the following represents a number in scientific notation correctly?
Signup and view all the answers
Which statement accurately describes how JavaScript handles numbers?
Which statement accurately describes how JavaScript handles numbers?
Signup and view all the answers
What is the maximum accuracy for integers in JavaScript without losing precision?
What is the maximum accuracy for integers in JavaScript without losing precision?
Signup and view all the answers
What value will be stored in 'y' after executing 'var y = 9999999999999999;'?
What value will be stored in 'y' after executing 'var y = 9999999999999999;'?
Signup and view all the answers
What does 'NaN' stand for in JavaScript?
What does 'NaN' stand for in JavaScript?
Signup and view all the answers
What will the result be when adding 0.2 and 0.1 in JavaScript?
What will the result be when adding 0.2 and 0.1 in JavaScript?
Signup and view all the answers
How does JavaScript interpret numeric constants prefixed with '0x'?
How does JavaScript interpret numeric constants prefixed with '0x'?
Signup and view all the answers
What does HTML stand for?
What does HTML stand for?
Signup and view all the answers
Who is responsible for making Web standards?
Who is responsible for making Web standards?
Signup and view all the answers
Which character is used to indicate an end tag in HTML?
Which character is used to indicate an end tag in HTML?
Signup and view all the answers
Which attribute specifies alternate text for an image in HTML?
Which attribute specifies alternate text for an image in HTML?
Signup and view all the answers
Which HTML element is used to create a hyperlink?
Which HTML element is used to create a hyperlink?
Signup and view all the answers
How can you open a link in a new tab or window in HTML?
How can you open a link in a new tab or window in HTML?
Signup and view all the answers
What is the correct HTML for inserting an image?
What is the correct HTML for inserting an image?
Signup and view all the answers
Which HTML element defines the title of a document?
Which HTML element defines the title of a document?
Signup and view all the answers
What is the correct way to express the Boolean expression p↔q using only ¬, ∧, and ∨?
What is the correct way to express the Boolean expression p↔q using only ¬, ∧, and ∨?
Signup and view all the answers
What is the negation of the statement ∀x∃y ( P( x) ∧ ¬Q( y ) )?
What is the negation of the statement ∀x∃y ( P( x) ∧ ¬Q( y ) )?
Signup and view all the answers
What distinguishes a subset from a proper subset?
What distinguishes a subset from a proper subset?
Signup and view all the answers
Why must a function be both 1-to-1 and onto to be considered invertible?
Why must a function be both 1-to-1 and onto to be considered invertible?
Signup and view all the answers
What is the cardinality of the power set of a set containing n elements?
What is the cardinality of the power set of a set containing n elements?
Signup and view all the answers
For a uniqueness proof, which two properties must be demonstrated?
For a uniqueness proof, which two properties must be demonstrated?
Signup and view all the answers
Which method involves proving a statement by showing that its negation leads to a contradiction?
Which method involves proving a statement by showing that its negation leads to a contradiction?
Signup and view all the answers
What is one key characteristic of a vacuous proof?
What is one key characteristic of a vacuous proof?
Signup and view all the answers
What is the relationship between a statement p and its converse q?
What is the relationship between a statement p and its converse q?
Signup and view all the answers
Which law states that p ∨ T ≡ T?
Which law states that p ∨ T ≡ T?
Signup and view all the answers
Which of the following is the result of applying Simplification?
Which of the following is the result of applying Simplification?
Signup and view all the answers
What does the Absorption Law state?
What does the Absorption Law state?
Signup and view all the answers
Which inference rule is used to conclude ¬p given [¬q ∧ (p → q)]?
Which inference rule is used to conclude ¬p given [¬q ∧ (p → q)]?
Signup and view all the answers
In set theory, what is the result of A ∩ (B ∪ C)?
In set theory, what is the result of A ∩ (B ∪ C)?
Signup and view all the answers
What does the Tautology Rule state when given p?
What does the Tautology Rule state when given p?
Signup and view all the answers
Which Boolean logic rule allows you to conclude p ∧ ¬p leads to F?
Which Boolean logic rule allows you to conclude p ∧ ¬p leads to F?
Signup and view all the answers
What is the result of applying pure logical reasoning to p ∨ ¬p?
What is the result of applying pure logical reasoning to p ∨ ¬p?
Signup and view all the answers
What is the outcome of applying Conjunction on two propositions p and q?
What is the outcome of applying Conjunction on two propositions p and q?
Signup and view all the answers
Which law identifies that p ∨ F is equivalent to p?
Which law identifies that p ∨ F is equivalent to p?
Signup and view all the answers
What is the principle behind the Hypothetical Syllogism?
What is the principle behind the Hypothetical Syllogism?
Signup and view all the answers
What is the outcome of applying Modus Ponens on p → q and p?
What is the outcome of applying Modus Ponens on p → q and p?
Signup and view all the answers
What does A ∅ represent in set theory?
What does A ∅ represent in set theory?
Signup and view all the answers
What does the TLD in a domain name stand for?
What does the TLD in a domain name stand for?
Signup and view all the answers
What is the primary function of the File Transfer Protocol (FTP)?
What is the primary function of the File Transfer Protocol (FTP)?
Signup and view all the answers
Which component of the domain name identifies the specific organization?
Which component of the domain name identifies the specific organization?
Signup and view all the answers
Which of the following languages is NOT considered a cornerstone technology for web page creation?
Which of the following languages is NOT considered a cornerstone technology for web page creation?
Signup and view all the answers
How does an FTP client typically relay information to a server?
How does an FTP client typically relay information to a server?
Signup and view all the answers
What does HTML stand for?
What does HTML stand for?
Signup and view all the answers
What is represented by the domain name 'www.example.com'?
What is represented by the domain name 'www.example.com'?
Signup and view all the answers
Which of the following is a characteristic of a subdomain?
Which of the following is a characteristic of a subdomain?
Signup and view all the answers
When should single quotes be used in HTML attributes?
When should single quotes be used in HTML attributes?
Signup and view all the answers
What is the main purpose of HTML comments?
What is the main purpose of HTML comments?
Signup and view all the answers
What functionality does the id attribute provide in HTML?
What functionality does the id attribute provide in HTML?
Signup and view all the answers
What is the role of the alt attribute in HTML?
What is the role of the alt attribute in HTML?
Signup and view all the answers
How can HTML comments assist during debugging?
How can HTML comments assist during debugging?
Signup and view all the answers
What do screen readers do with HTML content?
What do screen readers do with HTML content?
Signup and view all the answers
Why should software program tags be left inside HTML comments?
Why should software program tags be left inside HTML comments?
Signup and view all the answers
What is the expected use of the style attribute in HTML images?
What is the expected use of the style attribute in HTML images?
Signup and view all the answers
What will the value of the variable x be after executing var x = 100 / 'Apple';?
What will the value of the variable x be after executing var x = 100 / 'Apple';?
Signup and view all the answers
Which statement is true when using the == equality operator with numbers and Number objects?
Which statement is true when using the == equality operator with numbers and Number objects?
Signup and view all the answers
When using the === operator, what will be the result of (var x = 500; var y = new Number(500); x === y)?
When using the === operator, what will be the result of (var x = 500; var y = new Number(500); x === y)?
Signup and view all the answers
What will happen if you try to compare two Number objects with the == operator?
What will happen if you try to compare two Number objects with the == operator?
Signup and view all the answers
Which of the following methods converts a number into a string representation?
Which of the following methods converts a number into a string representation?
Signup and view all the answers
What does the method toExponential() do to a number in JavaScript?
What does the method toExponential() do to a number in JavaScript?
Signup and view all the answers
What property do primitive numbers lack in JavaScript?
What property do primitive numbers lack in JavaScript?
Signup and view all the answers
Why does JavaScript treat primitive values as objects when executing methods and properties?
Why does JavaScript treat primitive values as objects when executing methods and properties?
Signup and view all the answers
What occurs when a variable is declared without an initial value in JavaScript?
What occurs when a variable is declared without an initial value in JavaScript?
Signup and view all the answers
Which statement accurately represents how you can declare multiple variables in JavaScript?
Which statement accurately represents how you can declare multiple variables in JavaScript?
Signup and view all the answers
How does JavaScript treat a number when it is enclosed in quotation marks?
How does JavaScript treat a number when it is enclosed in quotation marks?
Signup and view all the answers
What will be the value of the variable 'carName' after its declaration if no value is assigned?
What will be the value of the variable 'carName' after its declaration if no value is assigned?
Signup and view all the answers
Which of the following is correct regarding the assignment of values to variables in JavaScript?
Which of the following is correct regarding the assignment of values to variables in JavaScript?
Signup and view all the answers
Which of the following correctly states the nature of JavaScript strings?
Which of the following correctly states the nature of JavaScript strings?
Signup and view all the answers
What happens if a variable is not initialized with a value in JavaScript and is accessed later?
What happens if a variable is not initialized with a value in JavaScript and is accessed later?
Signup and view all the answers
What keyword is used to declare a variable in JavaScript?
What keyword is used to declare a variable in JavaScript?
Signup and view all the answers
What will happen to the 'fruits' array after executing the line 'fruits = "Kiwi"'?
What will happen to the 'fruits' array after executing the line 'fruits = "Kiwi"'?
Signup and view all the answers
What will the 'fruits' array look like after executing 'fruits.splice(2, 1, "Lemon", "Kiwi")'?
What will the 'fruits' array look like after executing 'fruits.splice(2, 1, "Lemon", "Kiwi")'?
Signup and view all the answers
What is the result of calling 'fruits.sort()' on an array of fruits?
What is the result of calling 'fruits.sort()' on an array of fruits?
Signup and view all the answers
What will be the output of 'fruits.reverse()' after sorting the array?
What will be the output of 'fruits.reverse()' after sorting the array?
Signup and view all the answers
How does the compare function affect the sorting of an array?
How does the compare function affect the sorting of an array?
Signup and view all the answers
What does using 'delete fruits' do to the 'fruits' array?
What does using 'delete fruits' do to the 'fruits' array?
Signup and view all the answers
After executing 'fruits[fruits.length] = "Kiwi"', which of the following represents the contents of 'fruits'?
After executing 'fruits[fruits.length] = "Kiwi"', which of the following represents the contents of 'fruits'?
Signup and view all the answers
How can the 'sort()' method affect the order of numbers in an array?
How can the 'sort()' method affect the order of numbers in an array?
Signup and view all the answers
Study Notes
JavaScript Functions
- Functions are blocks of code designed to perform specific tasks.
- Function invocation (calling) triggers execution.
- Function definitions use the
function
keyword followed by a name and parentheses. - Parameters are names listed in the function definition.
- Arguments are real values received when the function is invoked.
- Functions can be invoked by events like user clicks, from JavaScript code, or automatically (self-invoked).
-
return
statements stop function execution and return a value to the invoking statement.
JavaScript Scope
- Scope refers to the accessible variables, objects, and functions within a particular part of a program.
- JavaScript uses function scope, meaning scope changes within functions.
- Local variables are declared within a function and are only accessible within that function.
- Global variables are declared outside functions and are accessible to all scripts and functions on a page.
- Undeclared variables assigned a value automatically become global variables.
JavaScript Operators
- Operators are used for arithmetic and comparisons.
- The assignment operator (
=
) assigns a value to a variable. - The addition operator (
+
) adds numbers and concatenates strings. - The
+=
operator adds to existing values.
JavaScript Strings
- Strings can be primitive values or objects.
- Primitive strings are created from literals using double quotes (
""
). - String objects are created using the
new String()
constructor. - The
==
operator checks for equality of string values. - The
===
operator checks for equality of both type and value.
JavaScript Numbers
- Numbers can be written with or without decimals.
- Scientific notation (exponent notation) is used for very large or small numbers.
- JavaScript numbers are always 64-bit floating-point numbers.
- Integers are accurate up to 15 digits.
- Floating-point arithmetic may not be perfectly accurate.
- Hexadecimal numbers are preceded by
0x
. -
Infinity
is returned for calculations exceeding the maximum number or division by zero. -
NaN
(Not a Number) indicates invalid number calculations.
JavaScript Arrays
- Arrays are ordered lists of values.
- Elements are accessed using numeric indexes starting from 0.
- Arrays can contain various data types.
- Length property indicates the number of elements in the array.
- Arrays are used to store collections of related data.
- Use
[]
brackets to create arrays, avoiding thenew Array()
constructor.
JavaScript Objects
- Objects are collections of key-value pairs.
- Keys are strings (names) while values can be any data type.
- Objects are useful for grouping related data under meaningful names.
- Use curly braces (
{}
) to create objects. - Methods are functions associated with objects.
- Objects are not ordered collections.
Displaying Dates
- The script
document.getElementById("demo").innerHTML = Date();
displays the current date and time inside an HTML element with the id "demo".
JavaScript Date Object
- The
Date
object is used to work with dates and times. - A date consists of a year, month, day, hour, minute, second, and milliseconds.
- Date objects are created with the
new Date()
constructor. -
new Date()
: Creates a new date object representing the current date and time. -
new Date(milliseconds)
: Creates a new date object representing the given number of milliseconds since January 1, 1970, 00:00:00 UTC. -
new Date(dateString)
: Creates a new date object from a date string. -
new Date(year, month, day, hours, minutes, seconds, milliseconds)
: Creates a new date object with the specified date and time, using 7 numerical arguments.
Date Methods
- Date methods allow you to get and set the year, month, day, hour, minute, second, and millisecond of date objects.
- The
toString()
method converts a date object to a string representation. - The
toUTCString()
method converts a date object to a UTC string.
JavaScript Operators
- The
=
operator assigns a value to a variable. - The
+
operator can be used to add numbers or concatenate strings. - The
+=
operator is used to add (concatenate) strings and assign the result to the original variable.
Adding Strings and Numbers
- Adding two numbers results in the sum.
- Adding a number and a string results in a concatenated string.
JavaScript Functions
- A function is a block of code designed to perform a specific task.
- Functions are invoked (called) to execute the code they contain.
- Functions are defined with the
function
keyword, followed by the function name, parentheses, and curly braces. - Function parameters are variables listed in the function definition.
- Function arguments are the actual values passed to the function during invocation.
Why Functions?
- Functions allow you to reuse code.
- Comments within functions are ignored and not executed.
JavaScript Case Sensitivity
- JavaScript is case sensitive, meaning
lastName
andlastname
are different variables.
JavaScript and Camel Case
- Camel case is a common naming convention for variables in JavaScript.
- Camel case starts with a lowercase letter and capitalizes the first letter of subsequent words, for example,
firstName
andmasterCard
.
JavaScript Character Set
- JavaScript uses the Unicode character set, which covers most characters, punctuations, and symbols from various languages.
JavaScript Statements
- Statements tell the browser what to do.
- Statements are executed sequentially, unless modified by control flow structures.
- Statements are separated by semicolons (;).
JavaScript White Space
- JavaScript ignores multiple spaces between elements.
- Whitespace can be used for readability.
JavaScript Line Length and Line Breaks
- Long JavaScript statements can be broken across multiple lines.
- It's best to break lines after operators.
JavaScript Code Blocks
- Statements can be grouped within code blocks enclosed in curly braces
{...}
. - Code blocks define statements to be executed together.
JavaScript Comments
- Comments are used to explain code and improve readability.
- Comments are ignored by JavaScript.
- Single-line comments start with
//
. - Multi-line comments start with
/*
and end with*/
.
JavaScript Variables
- Variables are containers for storing data values.
- Variable names are unique identifiers, using a combination of letters, digits, underscores (
_
), and dollar signs ($
). - Variable names must start with a letter,
_
, or$
. - Variable names are case-sensitive.
JavaScript Assignment Operator
- The
=
operator assigns a value to a variable. - It is not an "equal to" operator in the mathematical sense.
JavaScript Numbers
- Numbers can be primitive values or objects.
- Primitive numbers are created from literals, for example,
var x = 123
. - Number objects are created using the
new Number()
constructor.
Equality Operators for Numbers
-
==
operator checks for equality in value only. -
===
operator checks for equality in value and type. - Objects cannot be compared using equality operators.
Number Properties and Methods
- Primitive values don't have properties and methods.
- However, JavaScript treats primitive values as objects when executing methods and properties temporarily.
JavaScript Variable Lifetime
- The lifetime of a JavaScript variable starts when it is declared.
- Local variables are deleted when the function they are defined in is complete.
- Global variables are deleted when the browser window or tab they are defined in is closed.
- Function arguments (parameters) act as local variables within functions.
- Global variables are stored in the
window
object.
JavaScript Events
- JavaScript interacts with HTML using events.
- Events are actions that occur in the browser or user interactions with the page.
- Common events include:
- Page loading
- Changes in input field values
- Clicking a button
- You can write JavaScript code that executes when a specific event occurs.
- Event Handlers are attributes in HTML elements that allow JavaScript code to be executed when an event occurs.
- Example:
<button onclick="myFunction()">Click me</button>
- The
onclick
attribute calls themyFunction()
when the button is clicked.
JavaScript Strings
- JavaScript strings store sequences of characters enclosed in quotes.
- You can use single or double quotes to define a string.
- Example:
"Mike Slough"
or'Mike Slough'
- You can embed quotes within strings as long as they don't match the surrounding quotes.
- Example:
"This string has 'single' quotes inside"
JavaScript Operators
- JavaScript operators allow you to perform mathematical operations on variables.
- Common operators include:
-
=
: assignment operator, assigns a value to a variable. -
+
: addition operator, adds two values. - Example:
-
var x = 5 + 2 + 3;
-
var x = 5; // assigns the value 5 to x
-
var y = 2; // assigns the value 2 to y
-
var z = x + y; // assigns the value 7 to z (x + y)
JavaScript String Operators
- The
+
operator can concatenate (join) strings. - Example:
-
txt1 = "John";
-
txt2 = "Doe";
-
txt3 = txt1 + " " + txt2; // txt3 becomes "John Doe"
- The
+=
operator can also be used to concatenate strings. - Example:
-
txt1 = "What a very ";
-
txt1 += "nice day"; // txt1 becomes "What a very nice day"
Adding Strings and Numbers
- Adding two numbers results in their sum.
- Adding a number and a string results in a string concatenation.
- Example:
-
x = 5 + 5; // x becomes 10
-
y = "5" + 5; // y becomes "55"
-
z = "Hello" + 5; // z becomes "Hello5"
JavaScript Functions
- A JavaScript function is a block of code that performs a specific task.
- Functions are executed when called or invoked.
-
Syntax:
function functionName(parameter1, parameter2, parameter3) { // code to be executed }
- Parameters are the names listed in the function definition.
- Arguments are the actual values passed to the function when it is called.
- Function invocation can be triggered by:
- Events (like user clicks)
- Calls from other JavaScript code
- Self-invocation (automatically running)
-
Return statement: When a
return
statement is encountered within a function, the function stops executing and returns a value to the caller. - Importance of Functions:
- Code reusability: Define a function once and use it multiple times.
JavaScript Data Types
- JavaScript variables can hold different types of data.
- Two main data types:
- Numbers: Like 100
- Strings: Text values like "John Doe"
- Strings are written within double or single quotes.
- Example:
"John Doe"
or'John Doe'
- Numbers are written without quotes.
- Example:
100
- If a number is enclosed within quotes, JavaScript treats it as a string.
Declaring JavaScript Variables
- Declaring a variable in JavaScript is called "declaring" it.
- You use the
var
keyword to declare a variable. - Example:
-
var carName;
- Initially, a declared variable has no value (it's undefined).
- You assign a value to a variable using the equals sign (
=
). - Example:
-
carName = "Volvo";
- You can declare multiple variables in one statement by separating them with commas.
- Example:
-
var person = "John Doe", carName = "Volvo", price = 200;
- If you re-declare a variable, it doesn't lose its existing value.
- Example:
-
var x = 34.00; // A number with decimals
-
var x = 34; // x remains 34.00
JavaScript Number Types
- JavaScript uses 64-bit floating-point numbers for all numeric values.
- Numbers are stored using the IEEE 754 standard.
- The format stores the number (fraction), exponent, and sign in separate bits:
- Value (Fraction/Mantissa): 52 bits
- Exponent: 11 bits
- Sign: 1 bit
- Precision:
- Integers are accurate up to 15 digits.
- Maximum decimal places: 17
- Floating-point operations may have slight inaccuracies.
JavaScript Hexadecimal Numbers
- JavaScript interprets a numeric constant as hexadecimal if it starts with
0x
. - Example:
var x = 0xFF; // x will be 255
JavaScript Infinity
- Infinity is a special number that represents a value larger than the largest possible number.
- It can be generated by dividing by zero or by performing operations that result in a value outside the maximum number range.
- Example:
-
var x = 2 / 0; // x will be Infinity
-
var y = -2 / 0; // y will be -Infinity
-
typeof Infinity
returns "number".
JavaScript NaN (Not a Number)
- NaN (Not a Number) is a special value indicating that a value is not a valid number.
JavaScript Dates
- JavaScript Date objects represent points in time.
- Use
new Date()
to create a new Date object. - Use
Date.parse()
to convert a string to a date object. - Use methods like
setDate()
,setFullYear()
,setHours()
,setMilliseconds()
to modify date components. - Use methods like
getDate()
,getFullYear()
,getHours()
,getMilliseconds()
to get date components. - Example:
-
var d = new Date(); // d becomes the current date
-
d.setDate(d.getDate() + 4); // Adds 4 days to d
- Compare dates using comparison operators like
>
,<
,===
.
JavaScript Arrays
- Arrays are variables that can hold multiple values.
- Each value in an array is accessed by its index, starting from 0.
- Example:
-
var cars = ["Toyota", "Honda", "BMW"];
-
cars[0] // returns "Toyota"
JavaScript Array Methods
-
push()
: Adds new elements to the end of an array. -
pop()
: Removes the last element of an array and returns it. -
unshift()
: Adds new elements to the beginning of an array. -
shift()
: Removes the first element of an array and returns it. -
slice()
: Extracts a portion of an array and returns a new array. -
splice()
: Adds or removes elements from an array at a specified index. -
concat()
: Combines two or more arrays and returns a new array. -
join()
: Converts an array into a string with a specified separator between elements. -
reverse()
: Reverses the elements of an array. -
sort()
: Sorts elements of an array in ascending order. -
forEach()
: Executes a provided function for each element in the array. -
indexOf()
: Returns the index of the first occurrence of a specified element in the array.
URL Encoding
- URLs cannot contain spaces.
- Spaces are replaced with a plus (+) sign or %20
HTTP
- Hypertext Transfer Protocol
- Application level protocol
- Request-response protocol between client and server over the web
- Foundation of data communication for the World Wide Web
HTTP Requests
-
GET requests data from a specified resource:
- Has a limited length
- Can be cached by the client
-
POST submits data to be processed to a specified resource:
- Has no data limit
- Never cached
HTTPS
- Hypertext Transfer Protocol Secure
- HTTP over SSL
- All communications between client and server are encrypted and authenticated
Web Server
- A program that uses HTTP to serve files that form web pages
- Responds to user requests from HTTP clients
- Can also refer to dedicated computers or appliances
Application Server
- Software framework that provides facilities to create web applications
- Provides a server environment to run web applications
- Acts as a set of components accessible to the developer through an API
Web Services
- Client and server applications that communicate over the WWW using HTTP
- Typically reside on a web server
- Use XML to communicate messages
Web Agents / User Agents
- Software applications used by users to communicate with a web server
- Retrieve resources or receive data
- Web browsers are the most common example
Domain
- A unique name for your website
HTML Elements
- HTML5 does not require empty elements to be closed, but it's recommended for strict validation or XML parser readability.
- HTML tags are not case sensitive.
HTML Attributes
- Provide additional information about an element
- Specified in the start tag
- Name/value pairs
The lang
Attribute
- Declares the document language in the
<html>
tag - Important for accessibility applications and search engines
The title
Attribute
- Provides a title for HTML elements
- Example:
<p title="paragraph">
The href
Attribute
- Defines links in HTML documents
- Specifies the link address in the
href
attribute - Example:
<a href="https://www.google.com">Visit Google!</a>
Size Attributes
- Used with the
<img>
tag to define the width and height of an image - Example:
<img src="image.jpg" width="100" height="100">
Attribute Names
- HTML5 doesn't require lowercase attribute names, but it's recommended
Attribute Values
- HTML5 doesn't require quotes around attribute values, but it's recommended
- Double quotes are most common, but single quotes can be used
HTML Comments
- Not displayed by the browser
- Used for documentation, notifications, and reminders
- Example:
<!-- This is a comment -->
- Useful for debugging by commenting out code
- Can be generated by HTML software programs like FrontPage and Expression Web
HTML Links
- Hyperlinks, text or images you can click on to jump to another document
- Defined with the
<a>
tag - Example:
<a href="https://www.google.com">Visit Google!</a>
Image as Link
- Images can be used as links within HTML
- Example:
<a href="https://www.google.com"><img src="image.jpg" alt="Google Logo"></a>
The id
Attribute
- Used to create bookmarks inside HTML documents
- Bookmarks are invisible to the reader
- Example:
<p id="tips">Useful Tips Section</p>
The alt
Attribute
- Specifies an alternate text for an image if it cannot be displayed
- Describes the image in words
- Important for screen readers
Screen Readers
- Software programs that read what is displayed on a screen
- Convert HTML to text-to-speech, sound icons, or braille output
- Used by people with visual impairments
JavaScript Code Formatting
- If a JavaScript statement doesn't fit on one line, break it after an operator
- Example:
document.getElementById("demo").innerHTML = "Hello Dolly.";
JavaScript Code Blocks
- Statements grouped together inside curly brackets
{...}
- Define statements to be executed together
JavaScript Comments
- Explain and make code more readable
- Prevent execution during testing
-
Single line comments: Start with
//
-
Multi-line comments: Start with
/*
and end with*/
JavaScript Variables
- Containers for storing data values
- Example:
var x = 5;
JavaScript Identifiers
- Unique names used to identify variables
- Can contain letters, digits, underscores,
_
, and dollar signs,$
- Must begin with a letter or
$
or_
- Case sensitive (y and Y are different variables)
- Reserved words like JavaScript keywords cannot be used
The Assignment Operator
- The equal sign
=
is an assignment operator, not an "equal to" operator - Assigns a value to a variable
JavaScript Data Types
- JavaScript variables can hold different types of data:
-
Numbers : Example:
var pi = 3.14;
-
Strings: Text values enclosed in double or single quotes. Example:
var person = "John Doe";
-
Numbers : Example:
- If you put quotes around a number, it will be treated as a text string
Declaring (Creating) JavaScript Variables
- Use the
var
keyword - Example:
var carName;
- Assign a value using the equal sign
=
- Example:
carName = "Volvo";
Multiple Variable Declaration
- Declare multiple variables in one statement separated by commas
- Example:
var person = "John Doe", carName = "Volvo", price = 200;
Variable Value: undefined
- Variables declared without a value have the value
undefined
- The value can be calculated or provided later
Re-Declaring Variables
- Re-declaring a JavaScript variable does not lose its value
Domain Names
- A domain name is a part of a URL that tells a domain name server (DNS) where to forward a request for a web page.
- Domain names are mapped to IP addresses, representing physical points on the internet.
- Domain names consist of three parts:
- Top Level Domain (TLD): .pk, .com, .gov
- Second Level Domain: Must be unique on the internet and registered with an ICANN-accredited registrar
- Third Level Domain (Sub Domain): www, validate
- Example: www.google.com.pk
- TLD: .pk
- Second Level Domain: google
- Third Level Domain: www
Internet Hosting
- Allows organizations and individuals to serve content on the internet.
File Transfer Protocol (FTP)
- Standard network protocol used to transfer files between hosts over a TCP-based network.
- FTP is simple and secure.
- Files are split into small data packets.
- Client sends a packet to the destination after opening an authenticated connection.
- FTP server checks the packet and sends a request for the next packet until the entire file is received.
FTP Client
- Software used to communicate with an FTP server to transfer files using the FTP protocol.
HTML (Hyper Text Markup Language)
- Standard markup language used to create web pages.
- Used alongside CSS and JavaScript.
- Web browsers read HTML files and render them as visible or audible web pages.
JavaScript
- Case Sensitivity: JavaScript identifiers are case sensitive (lastName and lastname are different variables).
-
Camel Case: A convention for naming variables with multiple words.
- Starts with a lowercase letter, followed by capitalized words (firstName, masterCard).
- JavaScript Character Set: Uses the Unicode character set, covering most characters, punctuation, and symbols.
JavaScript Statements
- Instructions that tell the browser what to do.
- Executed one by one, in the order they are written.
- Separated by semicolons (;).
- White Space: Ignored by JavaScript.
- Line Length and Line Breaks: Programmers often avoid code lines longer than 80 characters. Lines can be broken after operators or using string addition.
Strings
- Strings must be written within quotes (' or ").
- Use the backslash escape character () to represent special characters like ' or " inside a string.
- String Length: Found in the built-in property "length".
- String as Objects: Can be defined as objects using the "new" keyword.
Numbers
- Can be written with or without decimals.
- Scientific Notation: Used for very large or very small numbers (e.g., 123e5).
- JavaScript Numbers as 64-bit Floating Point: Numbers are stored as double precision floating point numbers, following the IEEE 754 standard.
- Precision: Integers are accurate up to 15 digits. Floating point arithmetic can be imprecise.
- Hexadecimal: Numeric constants preceded by 0x are interpreted as hexadecimal (e.g., 0xFF).
- Infinity: Returned when a number is outside the largest possible number.
- NaN (Not a Number): Indicates that a value is not a number.
What does HTML stand for?
- HTML stands for Hyper Text Markup Language.
Who is making the Web standards?
- The World Wide Web Consortium (W3C) makes web standards.
Largest Heading
- The
<h1>
tag is the largest heading in HTML.
Line Break
- The
<br>
tag is used to insert a line break.
Background Color
- The
bgcolor
attribute is used to add a background color.
Important & Emphasized Text
- The
<strong>
tag defines important text - The
<em>
tag defines emphasized text.
Hyperlinks
- The
<a>
tag is used to create a hyperlink. - The
href
attribute specifies the URL of the link. - The
target
attribute specifies where to open the link (e.g., "_blank" for a new tab/window).
Ending Tags
- The
/
character is used to indicate an end tag.
HTML Elements
-
<h1>, <h2>, <h3>, <h4>, <h5>, <h6>
are all heading elements.
Numbered List
- The
<ol>
tag is used to create a numbered list. - The
<li>
tag defines each list item
Bulleted List
- The
<ul>
tag is used to create a bulleted list. - The
<li>
tag defines each list item.
Checkbox
- The
<input type="checkbox">
tag is used to make a checkbox.
Text Input Field
- The
<input type="text">
tag is used to make a text input field.
Drop-down List
- The
<select>
tag is used to make a drop-down list. - The
<option>
tag defines each option in the list - The
value
attribute defines the value associated with each option.
Text Area
- The
<textarea>
tag is used to make a text area.
Image Insertion
- The
<img>
tag is used to insert an image. - The
src
attribute specifies the URL of the image. - The
alt
attribute specifies alternative text for the image, if the image cannot be displayed.
Background Image
- The
background
attribute in the<body>
tag is used to insert a background image.
Title of Document
- The
<title>
tag defines the title of a document.
Alternate Text for Images
- The
alt
attribute is used to specify alternate text for an image.
HTML5 Doctype
- The
<!DOCTYPE html>
doctype is correct for HTML5.
Footer
- The
<footer>
tag is used to specify a footer for a document or section.
Video and Audio Files
- The
<video>
tag is used to play video files - The
<audio>
tag is used to play audio files.
Midterm 1: CS 202, Spring 2005
- Logic section covers 33 points
- Structures section covers 16 points
- Proofs section covers 51 points
- Exam has 100 points in total and lasts 75 minutes
- Part I covers logical equivalences, logic operators, and quantifiers
- Part II covers set theory, function composition, and cardinality
- Part III covers types of proofs, including direct, indirect, and proof by contradiction
- Question 1: asks for the converse of a conditional statement p→q
- Question 2: asks for an equivalent compound proposition using ¬, ∧, and ∨
- Question 3: asks for the negation of a quantified statement
- Question 4: asks for the two ways to convert a propositional function into a proposition
- Question 5: asks for a proof using logic equivalences
- Question 6: asks for the difference between subset and proper subset
- Question 7: asks about 1-to-1 and onto properties required for invertibility
- Question 8: asks for the cardinality of the power set of a set with n elements
- Question 9: asks for the composition of two functions f and g
- Question 10: asks for the two core properties needed for proving uniqueness
- Question 11: asks for writing the existential generalization of a quantified statement
- Question 12: asks for the difference between vacuous and trivial proofs
- Question 13: asks for the specific movie previewed in class
- Question 14: asks for a proof that if m is even, then m+7 is odd. Students can choose from two methods: direct proof, indirect proof, or proof by contradiction
- Question 15: is about statement implication and proof by contradiction
Domain Name
- A part of a Uniform Resource Locator (URL) that identifies a specific website on the internet
- It's used by the Domain Name System (DNS) to find the corresponding IP address of the website
- Examples include google.com, facebook.com, validate.ecp.gov
Domain Name Structure
- Top Level Domain (TLD): The final part of the domain name (e.g., .com, .org, .gov)
- Second Level Domain: Unique and registered with an ICANN-accredited registrar (e.g., google, facebook, validate)
- Third Level Domain (Sub Domain): A subdomain of the second-level domain (e.g., www, mail)
Hosting
- A service for organizations and individuals to make their web content accessible on the internet
- They provide servers and related technology to run websites.
File Transfer Protocol (FTP)
- A protocol used to transfer files between computers over a network (like the internet)
- It splits files into packets and transfers them after authentication
- FTP clients are software used to communicate with FTP servers
Hyper Text Markup Language (HTML)
- The standard language for creating web pages
- Used alongside CSS and JavaScript for building websites and user interfaces
- Web browsers interpret HTML files to render them into visible web pages.
HTML Links
- Hyperlinks are text or images that link to other documents.
- They are defined with the
<a>
tag in HTML. -
Syntax:
<a href="link_address">Link text</a>
HTML Images
- Image links are defined with the
<img>
tag in HTML. - They are defined with the
<img>
tag in HTML. -
Syntax:
<img src="image_address" alt="alternative_text_for_image">
HTML Bookmarks
- Bookmarks are created using the
id
attribute in HTML. - They are not displayed on the page and are used for linking to specific sections of the page.
-
Example:
<h1 id="tips">Useful Tips Section</h1>
The alt
Attribute in HTML Images
- Provides alternative text for images that cannot be displayed.
- It describes the image in words for screen readers and users with visual impairments.
Screen Readers
- Software programs that convert the contents of a screen into different forms (e.g., text-to-speech, braille output)
- Help people who are blind, visually impaired, or have learning disabilities access web content.
Image Size
- The
width
andheight
attributes (or thestyle
attribute) can be used to resize images.
JavaScript Data Types
- Variables can hold different types of data:
- Numbers: Represent numerical values (e.g., 100, 3.14)
- Strings: Represent text values and are enclosed in quotes (e.g., "John Doe", "Hello world!")
- Undefined: Represents a variable that has not been assigned a value yet.
Declaring JavaScript Variables
-
var
keyword: Used to declare a variable. -
Assignment operator (
=
): Used to assign a value to a variable. -
Example:
var carName = "Volvo";
JavaScript Arrays
- Ordered collections of data.
- Use square brackets (
[]
) to create arrays. -
Example:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
Modifying Array Elements
- Access by index: Use the index to access specific array elements.
-
Example:
console.log(fruits[0]); // Outputs "Banana"
Adding Elements to Arrays
-
Appending at end: Use
array.length
to add elements to the end of the array. -
Example:
fruits[fruits.length] = "Kiwi";
// Pushes "Kiwi" to the end
Deleting Array Elements
-
delete
operator: Remove elements from an array and sets them toundefined
. -
Example:
delete fruits[0];
Splicing Arrays
- The
splice()
method adds new elements to an array. -
Example:
fruits.splice(2, 1, "Lemon", "Kiwi");
// Inserts "Lemon" and "Kiwi" at index 2, removing one existing element.
Sorting Arrays
- The
sort()
method sorts an array alphabetically. -
Example:
fruits.sort();
Reversing Arrays
- The
reverse()
method reverses the elements in an array. -
Example:
fruits.reverse();
Compare Function for Sorting Arrays
- The
sort()
method accepts a compare function to define a custom sort order. - The compare function should return a negative, zero, or positive value based on the comparison.
-
Example:
points.sort(function(a, b){return a-b});
// Sorts in ascending order.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Explore the concepts of functions and scope in JavaScript. This quiz covers function definitions, invocation, parameters, arguments, and the difference between local and global variables. Test your knowledge on how scope affects variable accessibility within your programs.