Top 50 Jquery Interview Questions with Answers

Jquery Interview Questions with Answers

1. What is jQuery?

a) A programming language
b) A library of JavaScript code
c) A web browser
d) A computer operating system

Answer: b

2. What is the latest version of jQuery?

a) 2.x.x
b) 3.x.x
c) 4.x.x
d) 5.x.x

Answer: b

3. What is the purpose of the jQuery library?

a) To provide an easy way to write JavaScript code
b) To help developers create secure websites
c) To improve website performance
d) To simplify website design

Answer: a

4. How can you include jQuery in your webpage?

a) By downloading it from the jQuery website
b) By linking to it from a CDN
c) By copying and pasting the code from the jQuery website
d) All of the above

Answer: b

5. Which symbol is used to select classes in jQuery?

a) #
b) .
c) :
d) *

Answer: b

6. Which symbol is used to select IDs in jQuery?

a) #
b) .
c) :
d) *

Answer: a

7. Which method is used to hide an element in jQuery?

a) show()
b) hide()
c) remove()
d) clear()

Answer: b

8. Which method is used to animate an element in jQuery?

a) animate()
b) create()
c) transform()
d) modify()

Answer: a

9. Which method is used to add a class to an element in jQuery?

a) addClass()
b) removeClass()
c) toggleClass()
d) All of the above

Answer: a

10. Which method is used to remove a class from an element in jQuery?

a) addClass()
b) removeClass()
c) toggleClass()
d) All of the above

Answer: b

11. What is the purpose of the jQuery .each() method?

a) To loop through an array or object
b) To add elements to a webpage
c) To remove elements from a webpage
d) To animate elements on a webpage

Answer: a

12. Which method is used to get the text content of an element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: a

13. Which method is used to set the text content of an element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: a

14. Which method is used to get the HTML content of an element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: b

15. Which method is used to set the HTML content of an element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: b

16. Which method is used to get the value of a form element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: c

17. Which method is used to set the value of a form element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: c

18. Which method is used to get the attribute of an element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: d

19. Which method is used to set the attribute of an element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: d

20. Which method is used to get the parent element of an element in jQuery?

a) parent()
b) child()
c) sibling()
d) ancestor()

Answer: a

21. Which method is used to get the children elements of an element in jQuery?

a) parent()
b) child()
c) sibling()
d) ancestor()

Answer: b

22. Which method is used to get the sibling elements of an element in jQuery?

a) parent()
b) child()
c) sibling()
d) ancestor()

Answer: c

23. What is the difference between the .parent() method and the .parents() method in jQuery?

a) The .parent() method only returns the immediate parent element, while the .parents() method returns all ancestor elements.
b) The .parent() method only returns the first parent element, while the .parents() method returns all parent elements.
c) The .parent() method only returns elements with a specific class, while the .parents() method returns all elements.
d) The .parent() method only returns elements with a specific ID, while the .parents() method returns all elements.

Answer: a

24. Which method is used to filter elements in a selection in jQuery?

a) filter()
b) map()
c) reduce()
d) sort()

Answer: a

25. Which method is used to find elements in a selection in jQuery?

a) filter()
b) map()
c) reduce()
d) find()

Answer: d

26. Which method is used to add elements to a selection in jQuery?

a) add()
b) append()
c) prepend()
d) replace()

Answer: a

27. Which method is used to remove elements from a selection in jQuery?

a) remove()
b) detach()
c) clear()
d) erase()

Answer: a

28. Which method is used to bind an event handler to an element in jQuery?

a) on()
b) click()
c) bind()
d) attach()

Answer: a

29. Which method is used to trigger an event handler in jQuery?

a) trigger()
b) fire()
c) activate()
d) start()

Answer: a

30. What is the difference between the .click() method and the .on(‘click’) method in jQuery?

a) The .click() method can only be used on anchor elements, while the .on() method can be used on any element.
b) The .click() method can only be used once on an element, while the .on() method can be used multiple times.
c) The .click() method is shorthand for the .on(‘click’) method.
d) The .click() method cannot be used on form elements, while the .on() method can.

Answer: c

31. Which method is used to stop the default behavior of an event in jQuery?

a) stop()
b) preventDefault()
c) cancel()
d) halt()

Answer: b

32. Which method is used to stop an event from bubbling up the event chain in jQuery?

a) stopPropagation()
b) cancelBubble()
c) endPropagation()
d) terminateBubble()

Answer: a

33. Which method is used to delay the execution of code in jQuery?

a) delay()
b) pause()
c) hold()
d) wait()

Answer: a

34. Which method is used to animate the opacity of an element in jQuery?

a) fadeIn()/fadeOut()
b) show()/hide()
c) animate()
d) slideDown()/slideUp()

Answer: a

35. Which method is used to animate the height of an element in jQuery?

a) fadeIn()/fadeOut()
b) show()/hide()
c) animate()
d) slideDown()/slideUp()

Answer: d

36. Which method is used to animate the width of an element in jQuery?

a) fadeIn()/fadeOut()
b) show()/hide()
c) animate()
d) slideDown()/slideUp()

Answer: c

37. Which method is used to create a new element in jQuery?

a) create()
b) append()
c) prepend()
d) html()

Answer: a

38. Which method is used to add content to an element in jQuery?

a) create()
b) append()
c) prepend()
d) html()

Answer: d

39. Which method is used to remove all child elements from an element in jQuery?

a) empty()
b) remove()
c) detach()
d) erase()

Answer: a

40. Which method is used to replace an element with new content in jQuery?

a) replace()
b) replaceWith()
c) swap()
d) exchange()

Answer: b

41. Which method is used to serialize a form in jQuery?

a) form()
b) serialize()
c) submit()
d) serializeForm()

Answer: b

42. Which method is used to load data from a server and place it into an element in jQuery?

a) ajax()
b) load()
c) get()
d) fetch()

Answer: b

43. Which method is used to send data to a server in jQuery?

a) ajax()
b) load()
c) get()
d) post()

Answer: d

44. Which method is used to set a timer in jQuery?

a) setTimeout()
b) setInterval()
c) delay()
d) pause()

Answer: b

45. Which method is used to stop a timer in jQuery?

a) clearTimeout()
b) clearInterval()
c) stopInterval()
d) pauseInterval()

Answer: b

46. Which method is used to set the content of an input element in jQuery?

a) text()
b) html()
c) val()
d) attr()

Answer: c

47. Which method is used to disable an input element in jQuery?

a) enable()
b) disable()
c) readonly()
d) writable()

Answer: b

48. Which method is used to select elements based on their position in a selection in jQuery?

a) eq()
b) nth()
c) position()
d) order()

Answer: a

49. Which method is used to get the height of an element in jQuery?

a) height()
b) width()
c) length()
d) size()

Answer: a

50. Which method is used to get the width of an element in jQuery?

a) height()
b) width()
c) length()
d) size()

Answer: b

Top 50 JSON Interview Questions with Answers

JSON Interview Questions with Answers
  1. What does JSON stand for?
    a) JavaScript Object Notation
    b) Java Syntax Object Notation
    c) JSON Object Notation
    d) None of the above

Answer: a) JavaScript Object Notation

  1. What is JSON used for?
    a) Data interchange format
    b) JavaScript plugin
    c) Code execution
    d) HTML markup

Answer: a) Data interchange format

  1. Which of the following data types can be used in JSON?
    a) Strings
    b) Numbers
    c) Booleans
    d) All of the above

Answer: d) All of the above

  1. What is the maximum depth limit in JSON?
    a) There is no limit
    b) 10 levels
    c) 100 levels
    d) 1000 levels

Answer: a) There is no limit

  1. Which of the following is NOT a valid JSON value?
    a) Null
    b) Undefined
    c) Object
    d) Array

Answer: b) Undefined

  1. What does the toJSON() method do?
    a) Converts a JSON string into an object
    b) Converts an object into a JSON string
    c) Parses a JSON file
    d) None of the above

Answer: b) Converts an object into a JSON string

  1. Which method is used to parse JSON?
    a) parseJSON()
    b) parse()
    c) fromJSON()
    d) toJSON()

Answer: b) parse()

  1. What is JSONP used for?
    a) Cross-domain requests
    b) Client-side validation
    c) Server-side scripting
    d) None of the above

Answer: a) Cross-domain requests

  1. Which symbol represents the start and end of a JSON object?
    a) {}
    b) []
    c) ()
    d) <>

Answer: a) {}

  1. Which symbol separates the key and value pair in a JSON object?
    a) :
    b) ;
    c) ,
    d) |

Answer: a) :

  1. What is the MIME type for JSON?
    a) application/javascript
    b) application/xml
    c) application/json
    d) text/json

Answer: c) application/json

  1. Which JavaScript method is used to stringify an object into JSON format?
    a) toJSONString()
    b) parse()
    c) stringify()
    d) fromJSON()

Answer: c) stringify()

  1. Which of the following is NOT a valid JSON data type?
    a) Decimal
    b) String
    c) Number
    d) Object

Answer: a) Decimal

  1. Which of the following is used to represent arrays in JSON?
    a) {}
    b) []
    c) ()
    d) <>

Answer: b) []

  1. Which of the following is NOT a valid way to create a JSON object?
    a) var obj = { name: “John”, age: 30 };
    b) var obj = new Object();
    obj.name = “John”;
    obj.age = 30;
    c) var obj = {“name”: “John”, “age”: 30};
    d) var obj = [ “name”: “John”, “age”: 30];

Answer: d) var obj = [ “name”: “John”, “age”: 30];

  1. What is JSON Schema used for?
    a) To validate JSON data
    b) To convert JSON to XML
    c) To create JSON objects
    d) None of the above

Answer: a) To validate JSON data

  1. Which of the following is NOT a valid JSON Schema data type?
    a) integer
    b) boolean
    c) real
    d) string

Answer: c) real

  1. What is JSON-RPC used for?
    a) Remote procedure calls
    b) Server-side scripting
    c) Client-side validation
    d) None of the above

Answer: a) Remote procedure calls

  1. What is JSON-B used for?
    a) Serializing Java objects into JSON
    b) Parsing JSON data into Java objects
    c) Validating JSON data
    d) None of the above

Answer: a) Serializing Java objects into JSON

  1. What does the @JsonIgnore annotation do in JSON-B?
    a) Excludes a field from serialization
    b) Includes a field in serialization
    c) Validates a field value
    d) None of the above

Answer: a) Excludes a field from serialization

  1. What is JSON-LD used for?
    a) To embed context data within JSON
    b) To retrieve data from external sources
    c) To create JSON objects
    d) None of the above

Answer: a) To embed context data within JSON

  1. Which method is used to format JSON data for readability?
    a) json_format()
    b) pretty_print()
    c) format()
    d) None of the above

Answer: b) pretty_print()

  1. Which of the following is valid JSON syntax?
    a) { “name”: “John”, “age”: 30, };
    b) { name: “John”, age: 30 }
    c) {“name”: “John”, “age”: 30 }
    d) None of the above

Answer: c) {“name”: “John”, “age”: 30 }

  1. Which of the following characters is NOT escaped in JSON?
    a) Backspace
    b) Form feed
    c) Double quote
    d) Single quote

Answer: d) Single quote

  1. What is the JavaScript method used to evaluate a JSON string into an object?
    a) evalJSON()
    b) parseJSON()
    c) executeJSON()
    d) None of the above

Answer: b) parseJSON()

  1. Which of the following is NOT a property of the JSON object in JavaScript?
    a) JSON.parse()
    b) JSON.stringify()
    c) JSON.serialize()
    d) None of the above

Answer: c) JSON.serialize()

  1. What does the reviver parameter do in the JSON.parse() method?
    a) It is used to parse nested JSON data
    b) It is used to modify the parsed data
    c) It is used to validate the parsed data
    d) None of the above

Answer: b) It is used to modify the parsed data

  1. Which of the following is a correct JSON data structure?
    a) {“name”: “John”, “age”: 30, “isMarried”: true}
    b) {name: “John”, age: 30, isMarried: true}
    c) {name: “John”, age: 30, isMarried: True}
    d) None of the above

Answer: a) {“name”: “John”, “age”: 30, “isMarried”: true}

  1. Which of the following is NOT a valid way to get a JSON array from a string?
    a) JSON.parse(string)
    b) eval(string)
    c) string.toJSON()
    d) None of the above

Answer: c) string.toJSON()

  1. What is the difference between JSON and XML?
    a) JSON is easier to read and parse
    b) XML is more suited for complex data structures
    c) JSON is more widely used
    d) All of the above

Answer: d) All of the above

  1. Which of the following is NOT a valid way to create a JSON object in Java?
    a) JSONObject obj = new JSONObject();
    obj.put(“name”, “John”);
    obj.put(“age”, 30);
    b) Map, Object> map = new HashMap<>();
    map.put(“name”, “John”);
    map.put(“age”, 30);
    JSONObject obj = new JSONObject(map);
    c) String json = “{\”name\”:\”John\”,\”age\”:30}”;
    JSONObject obj = new JSONObject(json);
    d) None of the above

Answer: d) None of the above

  1. What is the syntax to access a property in a JSON object?
    a) object.property
    b) object[“property”]
    c) object->property
    d) None of the above

Answer: b) object[“property”]

  1. Which of the following is used to store a JSON object in a cookie?
    a) JSON.parse()
    b) JSON.stringify()
    c) JSON.serialize()
    d) None of the above

Answer: b) JSON.stringify()

  1. What is JSON Web Token (JWT) used for?
    a) Authentication and authorization
    b) Data serialization
    c) Remote procedure calls
    d) None of the above

Answer: a) Authentication and authorization

  1. Which of the following is a valid JSON example of a nested object?
    a) {“name”:”John”,”address”:{“street”:”123 Main St”,”city”:”Anytown”,”state”:”CA”}}
    b) {“name”:”John”,”address”:[“123 Main St”,”Anytown”,”CA”]}
    c) {“name”:”John”,”address”:{“street”:”123 Main St”},”address”:{“city”:”Anytown”},”address”:{“state”:”CA”}}
    d) None of the above

Answer: a) {“name”:”John”,”address”:{“street”:”123 Main St”,”city”:”Anytown”,”state”:”CA”}}

  1. What is the syntax to access an element in a JSON array?
    a) array[index]
    b) array[“index”]
    c) array->index
    d) None of the above

Answer: a) array[index]

  1. Which of the following is NOT a valid way to create a JSON object in Python?
    a) data = {“name”: “John”, “age”: 30}
    json_data = json.dumps(data)
    b) data = json.load(“data.json”)
    c) data = json.loads(‘{“name”: “John”, “age”: 30}’)
    d) None of the above

Answer: b) data = json.load(“data.json”)

  1. Which of the following is NOT a valid way to create a JSON array in JavaScript?
    a) var array = [“John”, 30, true];
    b) var array = new Array(“John”, 30, true);
    c) var array = {
    0: “John”,
    1: 30,
    2: true
    };
    d) None of the above

Answer: c) var array = {0: “John”, 1: 30, 2: true}

  1. What is the difference between a JSON object and a JavaScript object?
    a) There is no difference
    b) A JSON object is a string, while a JavaScript object is an actual object
    c) A JavaScript object is defined using curly braces, while a JSON object is defined using quotes
    d) None of the above

Answer: b) A JSON object is a string, while a JavaScript object is an actual object

  1. What is JSON streaming used for?
    a) To reduce memory consumption when working with large data sets
    b) To validate JSON data
    c) To create JSON objects
    d) None of the above

Answer: a) To reduce memory consumption when working with large data sets

  1. What is the syntax to add a property to a JSON object?
    a) object.newproperty = value;
    b) object[“newproperty”] = value;
    c) object.addproperty(value);
    d) None of the above

Answer: b) object[“newproperty”] = value;

  1. Which of the following is NOT a valid way to create a JSON object in Ruby?
    a) data = {“name” => “John”, “age” => 30}
    json_data = JSON.dump(data)
    b) data = JSON.parse(‘{“name”: “John”, “age”: 30}’)
    c) data = JSON.load(‘data.json’)
    d) None of the above

Answer: c) data = JSON.load(‘data.json’)

  1. What does the JSON.stringify() method return?
    a) A JSON string
    b) A JSON object
    c) A JavaScript object
    d) None of the above

Answer: a) A JSON string

  1. Which of the following is a correct JSON data structure for an array of objects?
    a) [{“name”: “John”, “age”: 30}, {“name”: “Jane”, “age”: 25}]
    b) {0: {“name”: “John”, “age”: 30}, 1: {“name”: “Jane”, “age”: 25}}
    c) [“name”: “John”, “age”: 30], [“name”: “Jane”, “age”: 25]
    d) None of the above

Answer: a) [{“name”: “John”, “age”: 30}, {“name”: “Jane”, “age”: 25}]

  1. Which of the following is valid JSON syntax for an array of numbers?
    a) [1, 2, 3.14]
    b) [“1”, “2”, “3.14”]
    c) [“one”, “two”, “three”]
    d) None of the above

Answer: a) [1, 2, 3.14]

  1. What is the syntax to remove a property from a JSON object?
    a) delete object.property;
    b) object.remove(property);
    c) object[“property”] = null;
    d) None of the above

Answer: a) delete object.property;

  1. Which of the following is NOT a valid way to create a JSON object in C#?
    a) JObject obj = new JObject();
    obj.Add(“name”, “John”);
    obj.Add(“age”, 30);
    b) JObject obj = JObject.Parse(‘{“name”: “John”, “age”: 30}’);
    c) string json = “{\”name\”:\”John\”,\”age\”:30}”;
    JObject obj = JsonConvert.DeserializeObjectObject>(json);
    d) None of the above

Answer: d) None of the above

  1. What is the difference between JSON and BSON?
    a) JSON is more widely used
    b) BSON is more suited for complex data structures
    c) BSON is faster to parse
    d) All of the above

Answer: c) BSON is faster to parse

  1. What is the maximum length for a JSON string?
    a) 4GB
    b) 1GB
    c) 16MB
    d) 10MB

Answer: c) 16MB

  1. Which of the following is NOT a valid way to retrieve data from a JSON object?
    a) object.property
    b) object[“property”]
    c) object.getProperty()
    d) None of the above

Answer: c) object.getProperty()

Top 50 YAML Interview Questions with Answers

YAML Interview Questions with Answers
  1. What does YAML stand for?
    a) Yet Another Markup Language
    b) YAML Ain’t Markup Language
    c) YAML Asks for Markup Language
    d) You Are Markup Language

Answer: b) YAML Ain’t Markup Language

  1. Which data types can be represented in YAML?
    a) Strings
    b) Integers
    c) Boolean
    d) All of the above

Answer: d) All of the above

  1. Which character is used to indicate a comment in YAML?
    a) #
    b) !
    c) *
    d) –

Answer: a)

  1. YAML is a:
    a) Markup language
    b) Scripting language
    c) Data serialization format
    d) None of the above

Answer: c) Data serialization format

  1. Which character is used to represent a sequence in YAML?
    a) !
    b) –
    c) ?
    d) :

Answer: b) –

  1. Which character is used to represent a mapping in YAML?
    a) !
    b) –
    c) ?
    d) :

Answer: d) :

  1. What is the extension of YAML files?
    a) .yaml
    b) .yml
    c) .yamlml
    d) .yam

Answer: b) .yml

  1. Which of the following is NOT a scalar data type in YAML?
    a) Integer
    b) String
    c) List
    d) Boolean

Answer: c) List

  1. Which of the following is a correct way to represent a block-style sequence in YAML?

a) –
item1
item2
item3

b) – item1, item2, item3

c) [item1, item2, item3]

d) (item1, item2, item3)

Answer:

a) –
item1
item2
item3

  1. Is indentation important in YAML?
    a) Yes
    b) No

Answer: a) Yes

  1. Which character is used to indicate the start of a new line in a YAML string?
    a) \
    b) |
    c) !
    d) &

Answer: b) |

  1. What is the difference between mapping and sequence in YAML?
    a) Mapping is key-value pairs while sequence is a list of values.
    b) Mapping is a list of values while sequence is key-value pairs.
    c) Mapping and sequence are identical in YAML.
    d) None of the above.

Answer: a) Mapping is key-value pairs while sequence is a list of values.

  1. Which of the following is NOT a valid way to represent a Boolean value in YAML?
    a) True
    b) true
    c) Yes
    d) On

Answer: d) On

  1. What is the difference between null and empty string in YAML?
    a) Null represents absence of a value while an empty string is a value that has no characters.
    b) Null and empty string can be used interchangeably in YAML.
    c) Null and empty string are identical in YAML.
    d) None of the above.

Answer: a) Null represents absence of a value while an empty string is a value that has no characters.

  1. Which of the following is a correct way to represent a block-style mapping in YAML?

a) person: {name: John, age: 40}

b) person:
name: John
age: 40

c) person: [name: John, age: 40]

d) person: (name: John, age: 40)

Answer:

b) person:
name: John
age: 40

  1. Which of the following is NOT a valid way to represent a null value in YAML?
    a) null
    b) ~
    c) Null
    d) None of the above

Answer: c) Null

  1. Which of the following is NOT a scalar data type in YAML?
    a) Integer
    b) String
    c) Mapping
    d) Boolean

Answer: c) Mapping

  1. Which of the following is the correct way to include a YAML file within another YAML file?
    a) &file include “filename.yml”
    b) << include “filename.yml”
    c) !include “filename.yml”
    d) #include “filename.yml”

Answer: c) !include “filename.yml”

  1. Which character is used to indicate a nested structure in YAML?
    a) .
    b) :
    c) >
    d) \

Answer: a) .

  1. What is the difference between a scalar and a non-scalar data type in YAML?
    a) Scalar data types have a single value while non-scalar data types can have multiple values.
    b) Scalar data types can be modified while non-scalar data types are fixed.
    c) Scalar data types are key-value pairs while non-scalar data types are lists of values.
    d) None of the above.

Answer: a) Scalar data types have a single value while non-scalar data types can have multiple values.

  1. What is the difference between a flow style and block style in YAML?
    a) Flow style is a compressed format while block style is a more spaced out format.
    b) Flow style does not require indentation while block style does.
    c) Flow style is a single line while block style is multiline.
    d) All of the above.

Answer: d) All of the above.

  1. Which of the following is a correct way to represent a multi-line string in YAML?

a) This is a multi-line string.

b) This is a \n
multi-line \n
string.

c) |
This is a
multi-line
string.

d) –
This is a
multi-line
string.

Answer: c) |

This is a
multi-line
string.

  1. Which of the following is NOT a valid way to represent a mapping key in YAML?
    a) key: value
    b) ‘key’: value
    c) “key”: value
    d) $key: value

Answer: d) $key: value

  1. Which of the following is a correct way to represent a block-style sequence of sequences in YAML?

a) –

  • item1
  • item2
  • item3
  • item4

b) [item1, item2], [item3, item4]

c) (item1, item2), (item3, item4)

d) –

  • [item1, item2]
  • [item3, item4]

Answer:

d) –

  • [item1, item2]
  • [item3, item4]
  1. What is the difference between an alias and an anchor in YAML?
    a) An alias refers to an anchor while an anchor refers to a specific location.
    b) An anchor is used to create an alias while an alias is used to reference an anchor.
    c) An alias and an anchor are identical in YAML.
    d) None of the above.

Answer: b) An anchor is used to create an alias while an alias is used to reference an anchor.

  1. Which of the following is a correct way to represent a tagged value in YAML?

a) !tag value

b) – !tag value

c) !tag
value

d) None of the above.

Answer: c) !tag

value

  1. What is the difference between a single-quoted and double-quoted string in YAML?
    a) Single-quoted strings cannot contain escape sequences while double-quoted strings can.
    b) Double-quoted strings cannot contain escape sequences while single-quoted strings can.
    c) Single-quoted strings are case sensitive while double-quoted strings are not.
    d) None of the above.

Answer: a) Single-quoted strings cannot contain escape sequences while double-quoted strings can.

  1. Which of the following is a correct way to represent a block-style map of scalar values in YAML?

a) {key1: value1, key2: value2}

b) –
key1: value1
key2: value2

c) key1: value1
key2: value2

d) None of the above.

Answer: c) key1: value1

key2: value2

  1. Which character is used to represent an escape sequence in YAML?
    a) \
    b) %
    c) $
    d) @

Answer: a) \

  1. Which of the following is NOT a valid way to represent a date in YAML?
    a) 2021-07-27
    b) 20210727
    c) ‘2021-07-27’
    d) 07/27/2021

Answer: d) 07/27/2021

  1. The default mapping style in YAML is:
    a) Flow
    b) Block

Answer: b) Block

  1. Which of the following is a reserved keyword in YAML?
    a) include
    b) list
    c) task
    d) None of the above.

Answer: a) include

  1. Which character is used to indicate a literal scalar value in YAML?
    a) |
    b) >
    c) &
    d) !

Answer: a) |

  1. Which character is used to indicate a folded scalar value in YAML?
    a) |
    b) >
    c) &
    d) !

Answer: b) >

  1. The default scalar style in YAML is:
    a) Single-quoted
    b) Double-quoted
    c) Plain
    d) None of the above.

Answer: c) Plain

  1. Which of the following is NOT a valid way to represent a timestamp in YAML?
    a) 2021-07-27T10:23:15Z
    b) 20210727102315
    c) ‘2021-07-27T10:23:15Z’
    d) 07/27/2021 10:23:15

Answer: d) 07/27/2021 10:23:15

  1. Which of the following is a correct way to indicate a tag in YAML?

a) !tag
b) tag:
c) #tag
d) @tag

Answer: a) !tag

  1. Which character is used to indicate that a scalar value should be represented in block style?
    a) |
    b) >
    c) []
    d) {}

Answer: a) |

  1. Which of the following is a correct way to represent a block-style map of non-scalar values in YAML?

a) {key1: [value1, value2], key2: {subkey1: value3, subkey2: value4}}

b) –
key1:

  • value1
  • value2
    key2:
    subkey1: value3
    subkey2: value4

c) key1: [value1, value2]
key2: {subkey1: value3, subkey2: value4}

d) None of the above.

Answer:

b) –
key1:

  • value1
  • value2
    key2:
    subkey1: value3
    subkey2: value4
  1. Which character is used to indicate that a scalar value should be represented in flow style?
    a) |
    b) >
    c) []
    d) {}

Answer: d) {}

  1. Which of the following is a correct way to include a scalar value from another YAML file?

a) &file include “filename.yml”
b) << include “filename.yml”
c) !include “filename.yml”
d) #include “filename.yml”

Answer: b) << include “filename.yml”

  1. Which of the following is NOT a valid way to represent a list in YAML?
    a) [- item1, item2]
    b) [item1, item2]
    c) –
  • item1
  • item2
    d) {item1: value1, item2: value2}

Answer: d) {item1: value1, item2: value2}

  1. Which of the following is a correct way to represent a block-style literal scalar value in YAML?

a) |
This is a
literal scalar
value.

b) \
This is a \
literal scalar \
value.

c) ‘
This is a
literal scalar
value.’

d) “
This is a
literal scalar
value.”

Answer: a) |

This is a
literal scalar
value.

  1. Which character is used to indicate a folded scalar value with indentation in YAML?
    a) |
    b) >
    c) +
    d) <

Answer: d) <

  1. Which of the following is a correct way to represent a flow-style map of non-scalar values in YAML?

a) {key1: [value1, value2], key2: {subkey1: value3, subkey2: value4}}

b) key1: [value1, value2], key2: {subkey1: value3, subkey2: value4}

c) –
{key1: [value1, value2]}
{key2: {subkey1: value3, subkey2: value4}}

d) None of the above.

Answer: a) {key1: [value1, value2], key2: {subkey1: value3, subkey2: value4}}

  1. Which character is used to indicate a folded scalar value with no indentation in YAML?
    a) |
    b) >
    c) +
    d) <

Answer: c) +

  1. What does a YAML file start with?
    a) —
    b) ===
    c) ***
    d) |||

Answer: a) —

  1. Which of the following is a correct way to represent an alias in YAML?
    a) &alias value
    b) *alias
    c) !alias value
    d) None of the above.

Answer: b) *alias

  1. Which of the following is a built-in tag in YAML?
    a) !include
    b) !null
    c) !empty
    d) None of the above.

Answer: b) !null

  1. What is the basic structure of a YAML document?
    a) Comment, Scalar, Sequence, Mapping
    b) Scalar, Sequence, Mapping, Comment
    c) Mapping, Sequence, Scalar, Comment
    d) None of the above.

Answer: b) Scalar, Sequence, Mapping, Comment

Top 50 Powershell Interview Questions with Answers

Powershell Interview Questions with Answers
  1. What is PowerShell?
    a) A programming language
    b) A command-line shell scripting tool
    c) A database management software
    d) A web development platform

Answer: b) A command-line shell scripting tool

  1. Which of the following is not a PowerShell verb?
    a) Get
    b) Set
    c) Delete
    d) Add

Answer: c) Delete

  1. Which of the following cmdlets is used to retrieve objects from a remote system?
    a) Export-Csv
    b) Get-WmiObject
    c) Set-Variable
    d) Out-File

Answer: b) Get-WmiObject

  1. What is the default execution policy for PowerShell scripts?
    a) Restricted
    b) Unrestricted
    c) Undefined
    d) RemoteSigned

Answer: a) Restricted

  1. Which of the following operators is used to compare two values in PowerShell?
    a) ==
    b) =
    c) =>
    d) <=

Answer: a) ==

  1. Which of the following parameters can be used with Get-ChildItem cmdlet to only show hidden files?
    a) -IncludeHidden
    b) -ExcludeHidden
    c) -Force
    d) -Hidden

Answer: d) -Hidden

  1. Which of the following cmdlets is used to stop a running process?
    a) Stop-Process
    b) Kill-Process
    c) End-Process
    d) Terminate-Process

Answer: a) Stop-Process

  1. What is the purpose of the Set-ExecutionPolicy cmdlet?
    a) To change the PowerShell execution policy
    b) To set the data type of a variable
    c) To create a new function
    d) To modify the content of a file

Answer: a) To change the PowerShell execution policy

  1. Which of the following cmdlets is used to create a new directory in PowerShell?
    a) New-Directory
    b) Make-Directory
    c) Create-Directory
    d) New-Item

Answer: d) New-Item

  1. How can you run a PowerShell script on a remote computer?
    a) Use Invoke-Command cmdlet with -FilePath parameter
    b) Use Start-Process cmdlet with -FilePath parameter
    c) Use Enter-PSSession cmdlet
    d) Use Export-ScheduledJob cmdlet

Answer: a) Use Invoke-Command cmdlet with -FilePath parameter

  1. Which of the following cmdlets is used to measure the execution time of a script?
    a) Measure-Object
    b) Get-TimeZone
    c) Get-Date
    d) Get-ChildItem

Answer: a) Measure-Object

  1. Which of the following cmdlets is used to get information about installed Windows updates?
    a) Get-Process
    b) Get-Service
    c) Get-Hotfix
    d) Get-AppxPackage

Answer: c) Get-Hotfix

  1. What is the purpose of the Select-Object cmdlet in PowerShell?
    a) To filter the output of a command
    b) To sort the output of a command
    c) To select specific properties from the output of a command
    d) To select specific methods from the output of a command

Answer: c) To select specific properties from the output of a command

  1. Which of the following cmdlets is used to list all the running processes in PowerShell?
    a) Get-Process
    b) Get-Service
    c) Get-ChildItem
    d) Get-NetIPConfiguration

Answer: a) Get-Process

  1. Which of the following operators is used to combine two or more conditions in PowerShell?
    a) –
    b) &&
    c) ||
    d) +

Answer: b) &&

  1. Which of the following cmdlets is used to remove an item from the file system?
    a) Remove-Item
    b) Delete-Item
    c) Destroy-Item
    d) Kill-Item

Answer: a) Remove-Item

  1. How can you loop through the items in an array in PowerShell?
    a) Use the for loop
    b) Use the while loop
    c) Use the foreach loop
    d) Use the do-while loop

Answer: c) Use the foreach loop

  1. Which of the following cmdlets is used to display the current PowerShell version?
    a) Get-PowerShellVersion
    b) Get-Version
    c) Get-Module
    d) Get-Help

Answer: c) Get-Module

  1. Which of the following cmdlets is used to list all the services in PowerShell?
    a) Get-Process
    b) Get-Service
    c) Get-ChildItem
    d) Get-NetIPConfiguration

Answer: b) Get-Service

  1. Which of the following operators is used to redirect output to a file in PowerShell?
    a) >
    b) |
    c) >
    d) <

Answer: a) >

  1. Which of the following cmdlets is used to get help on a specific cmdlet or keyword in PowerShell?
    a) Get-Help
    b) Get-Command
    c) Get-Module
    d) Get-Service

Answer: a) Get-Help

  1. Which of the following cmdlets is used to retrieve information on running processes and related system information?
    a) Get-Process
    b) Get-Service
    c) Get-WinEvent
    d) Get-WmiObject

Answer: d) Get-WmiObject

  1. What is the purpose of the ForEach-Object cmdlet in PowerShell?
    a) To loop through a collection of objects and perform an operation on each object
    b) To display the current date and time
    c) To add items to an array
    d) To sort a collection of objects

Answer: a) To loop through a collection of objects and perform an operation on each object

  1. Which of the following cmdlets is used to get a list of available cmdlets in PowerShell?
    a) Get-Command
    b) Get-Help
    c) Get-Module
    d) Get-Parameter

Answer: a) Get-Command

  1. What is the difference between Write-Output and Write-Host cmdlets in PowerShell?
    a) Write-Output can be piped while Write-Host cannot be piped.
    b) Write-Host writes output to the console while Write-Output writes output to the pipeline.
    c) Write-Host writes output to the pipeline while Write-Output writes output to the console.
    d) Write-Output and Write-Host cmdlets are the same.

Answer: b) Write-Host writes output to the console while Write-Output writes output to the pipeline.

  1. Which of the following cmdlets is used to list all the environment variables in PowerShell?
    a) Get-Environment
    b) Get-Variable
    c) Get-Path
    d) Get-ChildItem

Answer: b) Get-Variable

  1. Which of the following cmdlets is used to display the contents of a file in PowerShell?
    a) Get-Content
    b) Set-Content
    c) Out-File
    d) Copy-Item

Answer: a) Get-Content

  1. What is the purpose of the Where-Object cmdlet in PowerShell?
    a) To filter data based on a specific criterion
    b) To sort data in ascending or descending order
    c) To group data based on a specific property
    d) To select specific properties from a collection of objects

Answer: a) To filter data based on a specific criterion

  1. Which of the following operators is used to perform a case-insensitive comparison in PowerShell?
    a) -eq
    b) -ne
    c) -ceq
    d) -cne

Answer: c) -ceq

  1. Which of the following cmdlets is used to extract specific elements from an array in PowerShell?
    a) Select-String
    b) Select-Object
    c) Select-Xml
    d) Select-Array

Answer: b) Select-Object

  1. Which of the following cmdlets is used to convert a number to a string in PowerShell?
    a) ConvertTo-String
    b) ConvertFrom-String
    c) ConvertTo-Number
    d) ConvertFrom-Number

Answer: a) ConvertTo-String

  1. Which of the following cmdlets is used to get information about disk drives in PowerShell?
    a) Get-WmiObject
    b) Get-Process
    c) Get-Service
    d) Get-Disk

Answer: d) Get-Disk

  1. What is the purpose of the Split method in PowerShell?
    a) To divide a string into multiple substrings based on a specific delimiter
    b) To concatenate two or more strings
    c) To remove white spaces from a string
    d) To convert a string to uppercase or lowercase

Answer: a) To divide a string into multiple substrings based on a specific delimiter

  1. Which of the following cmdlets is used to list all the installed modules in PowerShell?
    a) Get-Command
    b) Get-Process
    c) Get-Module
    d) Get-Service

Answer: c) Get-Module

  1. What is the purpose of the Sort-Object cmdlet in PowerShell?
    a) To sort data in ascending or descending order based on a specific property
    b) To select specific properties from a collection of objects
    c) To group data based on a specific property
    d) To filter data based on a specific criterion

Answer: a) To sort data in ascending or descending order based on a specific property

  1. Which of the following operators is used to perform a case-sensitive comparison in PowerShell?
    a) -eq
    b) -ne
    c) -ceq
    d) -cne

Answer: a) -eq

  1. Which of the following cmdlets is used to get the contents of a remote file in PowerShell?
    a) Get-ChildItem
    b) Invoke-Command
    c) Copy-Item
    d) Move-Item

Answer: b) Invoke-Command

  1. Which of the following cmdlets is used to display the contents of a directory in PowerShell?
    a) Get-Content
    b) Get-WmiObject
    c) Get-ChildItem
    d) Get-Service

Answer: c) Get-ChildItem

  1. What is the purpose of the Join method in PowerShell?
    a) To concatenate two or more strings
    b) To divide a string into multiple substrings based on a specific delimiter
    c) To remove white spaces from a string
    d) To convert a string to uppercase or lowercase

Answer: a) To concatenate two or more strings

  1. Which of the following cmdlets is used to create a new variable in PowerShell?
    a) New-Variable
    b) Set-Variable
    c) Create-Variable
    d) Declare-Variable

Answer: a) New-Variable

  1. What is the purpose of the Test-Connection cmdlet in PowerShell?
    a) To test the network connectivity between two computers
    b) To test the syntax of a PowerShell script
    c) To test the execution policy of PowerShell
    d) To test the PowerShell version

Answer: a) To test the network connectivity between two computers

  1. Which of the following cmdlets is used to list all the installed programs on a computer in PowerShell?
    a) Get-Process
    b) Get-Service
    c) Get-AppxPackage
    d) Get-InstalledProgram

Answer: c) Get-AppxPackage

  1. What is the purpose of the if statement in PowerShell?
    a) To execute a block of code if a condition is true
    b) To loop through a block of code while a condition is true
    c) To execute a block of code for a specific number of times
    d) To define a function in PowerShell

Answer: a) To execute a block of code if a condition is true

  1. Which of the following cmdlets is used to get information about the file system in PowerShell?
    a) Get-ChildItem
    b) Get-WmiObject
    c) Get-Drive
    d) Get-Volume

Answer: c) Get-Drive

  1. What is the purpose of the break statement in PowerShell?
    a) To exit a loop or a switch statement
    b) To continue to the next iteration of a loop
    c) To create a new line in the output
    d) To clear the console screen

Answer: a) To exit a loop or a switch statement

  1. Which of the following cmdlets is used to create a new registry key in PowerShell?
    a) New-RegKey
    b) Set-RegKey
    c) Create-RegKey
    d) New-ItemProperty

Answer: a) New-RegKey

  1. What is the purpose of the ForEach-Object cmdlet in PowerShell?
    a) To loop through a collection of objects and perform an operation on each object
    b) To sort data in ascending or descending order based on a specific property
    c) To group data based on a specific property
    d) To select specific properties from a collection of objects

Answer: a) To loop through a collection of objects and perform an operation on each object

  1. Which of the following operators is used to perform a wildcard match in PowerShell?
    a) *
    b) .
    c) #
    d) %

Answer: a) *

  1. Which of the following cmdlets is used to get information about the system memory in PowerShell?
    a) Get-Process
    b) Get-Service
    c) Get-WmiObject
    d) Get-Memory

Answer: c) Get-WmiObject

  1. What is the purpose of the switch statement in PowerShell?
    a) To execute different blocks of code based on the value of a variable
    b) To loop through a block of code while a condition is true
    c) To execute a block of code for a specific number of times
    d) To define a function in PowerShell

Answer: a) To execute different blocks of code based on the value of a variable.

Top 50 Bootstrap Interview Questions with Answers

Bootstrap Interview Questions with Answers
  1. What is Bootstrap?
    A) A programming language
    B) A framework for web development
    C) A database management tool
    D) None of the above

Answer: B

  1. What is the latest version of Bootstrap?
    A) 2.0
    B) 3.0
    C) 4.0
    D) 5.0

Answer: D

  1. What is the standard grid system in Bootstrap based on?
    A) 6 columns
    B) 8 columns
    C) 10 columns
    D) 12 columns

Answer: D

  1. Which class is used for creating a responsive navbar in Bootstrap?
    A) .navbar-default
    B) .navbar-inverse
    C) .navbar-responsive
    D) .navbar-collapse

Answer: D

  1. Which class is used for creating a responsive image in Bootstrap?
    A) .img-responsive
    B) .img-fluid
    C) .img-scale
    D) .img-flex

Answer: A

  1. Which class is used for creating a modal in Bootstrap?
    A) .modal-container
    B) .modal-dialog
    C) .modal-content
    D) .modal-window

Answer: B

  1. What is the CSS preprocessor used in Bootstrap?
    A) Less
    B) Sass
    C) Stylus
    D) All of the above

Answer: B

  1. Which class is used for creating a progress bar in Bootstrap?
    A) .progress-tracker
    B) .progress-bar
    C) .progress-graph
    D) .progressbar

Answer: B

  1. Which class is used for creating a carousel in Bootstrap?
    A) .carousel
    B) .slider
    C) .scroll-pane
    D) .carousel-gallery

Answer: A

  1. What is the default font-family in Bootstrap?
    A) Times New Roman
    B) Arial
    C) Verdana
    D) Helvetica Neue

Answer: D

  1. Which class is used for creating a jumbotron in Bootstrap?
    A) .jumbotron
    B) .hero-unit
    C) .big-banner
    D) .mega-header

Answer: A

  1. What is the difference between container and container-fluid in Bootstrap?
    A) container-fluid has a fixed width
    B) container-fluid has a fluid width
    C) container has a fixed width
    D) Both A and C

Answer: B

  1. Which class is used for creating a label in Bootstrap?
    A) .label
    B) .badge
    C) .tag
    D) .marker

Answer: A

  1. Which class is used for creating a dropdown menu in Bootstrap?
    A) .dropdown
    B) .options
    C) .select-menu
    D) .drop-menu

Answer: A

  1. What is the difference between button and input[type=”submit”] in Bootstrap?
    A) They are used for the same purpose
    B) button can contain HTML content and input[type=”submit”] cannot
    C) input[type=”submit”] is preferred for forms
    D) Both B and C

Answer: D

  1. Which class is used for creating a list group in Bootstrap?
    A) .list-group
    B) .group-list
    C) .list-item
    D) .item-list

Answer: A

  1. How can you customize the color palette in Bootstrap?
    A) By using the customize page on the Bootstrap website
    B) By editing the variables in the variables.less file
    C) By adding new classes in the custom.less file
    D) By using CSS overrides

Answer: B

  1. Which class is used for creating a navbar brand/logo in Bootstrap?
    A) .navbar-brand
    B) .navbar-logo
    C) .brand-logo
    D) .header-brand

Answer: A

  1. What is the default button style in Bootstrap?
    A) Primary
    B) Secondary
    C) Success
    D) Default

Answer: D

  1. Which class is used for creating a breadcrumb in Bootstrap?
    A) .breadcrumb
    B) .path
    C) .trail
    D) .way

Answer: A

  1. Which class is used for creating a tooltip in Bootstrap?
    A) .tooltip
    B) .hover-tip
    C) .pop-tip
    D) .click-tip

Answer: A

  1. Which class is used for creating a card in Bootstrap?
    A) .card
    B) .panel
    C) .box
    D) .container

Answer: A

  1. What is the difference between col-md-* and col-lg-* in Bootstrap?
    A) col-md-* is for medium screens and col-lg-* is for large screens
    B) col-lg-* has a wider width than col-md-*
    C) col-md-* is for small screens and col-lg-* is for large screens
    D) There is no difference

Answer: A

  1. Which class is used for creating a popover in Bootstrap?
    A) .popover
    B) .pop-up
    C) .popup-window
    D) .tip-box

Answer: A

  1. What is the difference between offset-* and push-* in Bootstrap?
    A) They are used for the same purpose
    B) offset-* moves the column to the right, while push-* moves the column to the left
    C) push-* moves the column to the right, while offset-* moves the column to the left
    D) There is no difference

Answer: C

  1. Which class is used for creating a form group in Bootstrap?
    A) .form-group
    B) .fieldset
    C) .input-group
    D) .form-unit

Answer: A

  1. What is the difference between .navbar-static-top and .navbar-fixed-top in Bootstrap?
    A) There is no difference
    B) .navbar-static-top is always at the top of the page, while .navbar-fixed-top is fixed to the top of the viewport
    C) .navbar-fixed-top is always at the top of the page, while .navbar-static-top is fixed to the top of the viewport
    D) Both A and C

Answer: B

  1. Which class is used for creating a pagination in Bootstrap?
    A) .pagination
    B) .paginator
    C) .page-list
    D) .paging

Answer: A

  1. What is the purpose of the Bootstrap grid system?
    A) To create responsive layouts
    B) To create fixed layouts
    C) To create fluid layouts
    D) Both B and C

Answer: A

  1. Which class is used for creating a progress spinner in Bootstrap?
    A) .spinner
    B) .progress-spinner
    C) .loading-bar
    D) .spinner-bar

Answer: A

  1. What is the difference between .container and .container-fluid in Bootstrap?
    A) .container has a fixed width, while .container-fluid has a fluid width
    B) .container-fluid has a fixed width, while .container has a fluid width
    C) They are used for the same purpose
    D) Both B and C

Answer: A

  1. Which class is used for creating a well in Bootstrap?
    A) .well
    B) .panel
    C) .card
    D) .container

Answer: A

  1. What is the purpose of the responsive utilities in Bootstrap?
    A) To modify the layout based on screen size
    B) To modify the font-size based on screen size
    C) To modify the background-color based on screen size
    D) To modify the padding based on screen size

Answer: A

  1. Which class is used for creating a form control in Bootstrap?
    A) .form-control
    B) .input-control
    C) .field-control
    D) .form-field

Answer: A

  1. What is the difference between .dropdown-menu and .dropdown-submenu in Bootstrap?
    A) .dropdown-menu is a single-level menu, while .dropdown-submenu is a multi-level menu
    B) .dropdown-submenu is a single-level menu, while .dropdown-menu is a multi-level menu
    C) They are used for the same purpose
    D) Both A and B

Answer: A

  1. Which class is used for creating a thumbnail in Bootstrap?
    A) .thumbnail
    B) .media
    C) .image-box
    D) .thumb-box

Answer: A

  1. What is the difference between .lead and .text-large in Bootstrap?
    A) They are used for the same purpose
    B) .lead is larger than .text-large
    C) .text-large is larger than .lead
    D) Both A and B

Answer: A

  1. Which class is used for creating a blockquote in Bootstrap?
    A) .blockquote
    B) .quote
    C) .text-quote
    D) .quotation

Answer: A

  1. What is the purpose of the .sr-only class in Bootstrap?
    A) To hide content visually, but still make it available to screen-readers
    B) To remove the content from the DOM
    C) To apply a style without showing the content
    D) None of the above

Answer: A

  1. Which class is used for creating a table in Bootstrap?
    A) .table
    B) .data-table
    C) .tabular
    D) .table-data

Answer: A

  1. What is the purpose of the .btn-group class in Bootstrap?
    A) To group buttons together
    B) To group form elements together
    C) To group links together
    D) To group images together

Answer: A

  1. Which class is used for creating a well with a border in Bootstrap?
    A) .well
    B) .panel
    C) .card
    D) .jumbotron

Answer: B

  1. What is the purpose of the .blockquote-reverse class in Bootstrap?
    A) To reverse the order of the blockquote and the citation
    B) To make the blockquote stand out
    C) To change the font of the blockquote
    D) To add a border around the blockquote

Answer: A

  1. Which class is used for creating a responsive embed in Bootstrap?
    A) .embed-responsive
    B) .responsive-video
    C) .flex-embed
    D) .video-embed

Answer: A

  1. What is the purpose of the .text-muted class in Bootstrap?
    A) To make the text gray
    B) To make the text italicized
    C) To make the text smaller
    D) To make the text unimportant

Answer: D

  1. Which class is used for creating a responsive utility class for display property in Bootstrap?
    A) .d-none
    B) .d-sm-none
    C) .d-md-none
    D) .d-lg-none

Answer: B

  1. What is the purpose of the .text-danger class in Bootstrap?
    A) To make the text red
    B) To make the text bold
    C) To make the text uppercase
    D) To make the text blink

Answer: A

  1. Which class is used for creating a responsive utility class for margin property in Bootstrap?
    A) .m-0
    B) .m-sm-0
    C) .m-md-0
    D) .m-lg-0

Answer: B

  1. What is the purpose of the .blockquote-footer class in Bootstrap?
    A) To add a footer to the blockquote
    B) To add a header to the blockquote
    C) To change the font-size of the blockquote
    D) To change the color of the blockquote

Answer: A

  1. Which class is used for creating a responsive utility class for padding property in Bootstrap?
    A) .p-0
    B) .p-sm-0
    C) .p-md-0
    D) .p-lg-0

Answer: B

Top 50 AngularJs Interview Questions with Answers

AngularJs Interview Questions with Answers
  1. What is AngularJS?
    a) A server-side language
    b) A database management system
    c) A front-end web application framework

Answer: c) A front-end web application framework

  1. What are directives in AngularJS?
    a) A set of rules
    b) A schema
    c) Extensions to HTML with new attributes and elements

Answer: c) Extensions to HTML with new attributes and elements

  1. What is data binding in AngularJS?
    a) An algorithm to compress data
    b) Synchronizing data between model and view
    c) Caching data for faster retrieval

Answer: b) Synchronizing data between model and view

  1. What is the purpose of ng-app directive in AngularJS?
    a) To define the root element of an application
    b) To define the ng-model attribute
    c) To define a dependency injection

Answer: a) To define the root element of an application

  1. What is AngularJS Expression?
    a) Combination of Variables, Operators, and Literals
    b) An AngularJS module
    c) An AngularJS template

Answer: a) Combination of Variables, Operators, and Literals

  1. What is $scope in AngularJS?
    a) A predefined AngularJS object
    b) A global variable
    c) A local variable

Answer: a) A predefined AngularJS object

  1. What is a service in AngularJS?
    a) A reusable business logic
    b) A web page
    c) A Java program

Answer: a) A reusable business logic

  1. Which built-in directive is used to loop through an array or object in AngularJS?
    a) ng-repeat
    b) ng-click
    c) ng-class

Answer: a) ng-repeat

  1. What is the use of ng-model directive in AngularJS?
    a) To define a model property
    b) To bind HTML elements to a model
    c) To define a function

Answer: b) To bind HTML elements to a model

  1. What is the use of ng-show directive in AngularJS?
    a) To show or hide HTML elements based on an expression
    b) To define a model property
    c) To define a function

Answer: a) To show or hide HTML elements based on an expression

  1. What is the difference between one-way data binding and two-way data binding in AngularJS?
    a) One-way data binding updates the model and the view, while two-way data binding only updates the model.
    b) One-way data binding updates the model only, while two-way data binding updates the model and the view.
    c) One-way data binding updates the view only, while two-way data binding updates the model and the view.

Answer: b) One-way data binding updates the model only, while two-way data binding updates the model and the view.

  1. What is $rootScope in AngularJS?
    a) A scope that is shared by all controllers in an application
    b) A scope that is isolated from all other scopes
    c) A scope that is only accessible from a specific controller

Answer: a) A scope that is shared by all controllers in an application

  1. What is a module in AngularJS?
    a) A function that returns an object
    b) A JavaScript file
    c) A predefined object in AngularJS

Answer: a) A function that returns an object

  1. What is the difference between $http and $resource in AngularJS?
    a) $http is used for read-only data, while $resource is used for both read and write operations.
    b) $http is used for both read and write operations, while $resource is used for read-only data.
    c) $http and $resource are identical in functionality.

Answer: a) $http is used for read-only data, while $resource is used for both read and write operations.

  1. What is dependency injection in AngularJS?
    a) A way of passing dependencies to a function
    b) A way of injecting dependencies into a controller
    c) A way of defining dependencies in a module

Answer: a) A way of passing dependencies to a function

  1. What is the use of ng-model-options directive in AngularJS?
    a) To define options for ng-model directive
    b) To define options for ng-repeat directive
    c) To define options for ng-show directive

Answer: a) To define options for ng-model directive

  1. What is the difference between ng-if and ng-show in AngularJS?
    a) ng-if removes the element from the DOM, while ng-show hides the element.
    b) ng-show removes the element from the DOM, while ng-if hides the element.
    c) ng-if and ng-show are identical in functionality.

Answer: a) ng-if removes the element from the DOM, while ng-show hides the element.

  1. What is the use of $q service in AngularJS?
    a) To create promises
    b) To create controllers
    c) To create directives

Answer: a) To create promises

  1. What is the use of dependency injection in AngularJS?
    a) To decouple modules from each other
    b) To couple modules together
    c) To reduce the size of modules

Answer: a) To decouple modules from each other

  1. What is angular.bootstrap() method in AngularJS?
    a) A method to manually bootstrap an AngularJS application
    b) A method to define a controller
    c) A method to define a dependency injection

Answer: a) A method to manually bootstrap an AngularJS application

  1. What is the use of ng-options in AngularJS?
    a) To bind a drop-down list to a model
    b) To define options for ng-if directive
    c) To define options for ng-show directive

Answer: a) To bind a drop-down list to a model

  1. Which built-in directive is used to bind HTML content in AngularJS?
    a) ng-bind
    b) ng-model
    c) ng-repeat

Answer: a) ng-bind

  1. What is $http service in AngularJS?
    a) A service to make HTTP requests
    b) A service to create controllers
    c) A service to create directives

Answer: a) A service to make HTTP requests

  1. What is AngularJS filter?
    a) A piece of code that transforms the data
    b) A part of an AngularJS module
    c) A type of HTML template

Answer: a) A piece of code that transforms the data

  1. What is the use of ng-submit directive in AngularJS?
    a) To define a model property
    b) To bind HTML elements to a model
    c) To handle form submission

Answer: c) To handle form submission

  1. What is the use of $routeParams service in AngularJS?
    a) To get the value of route parameters
    b) To create a new route
    c) To define a dependency injection

Answer: a) To get the value of route parameters

  1. What is the use of ng-mouseover directive in AngularJS?
    a) To handle mouse hover event
    b) To handle mouse click event
    c) To handle mouse wheel event

Answer: a) To handle mouse hover event

  1. What is the use of ng-blur directive in AngularJS?
    a) To bind HTML elements
    b) To handle button press event
    c) To handle input element losing focus

Answer: c) To handle input element losing focus

  1. What is the use of ng-style directive in AngularJS?
    a) To define a model property
    b) To bind HTML elements to a model
    c) To set CSS styles dynamically

Answer: c) To set CSS styles dynamically

  1. What is the use of ng-cloak directive in AngularJS?
    a) To set styles for elements that have not been loaded yet
    b) To hide elements that have not been loaded yet
    c) To prevent elements from flashing before the AngularJS application is fully loaded

Answer: c) To prevent elements from flashing before the AngularJS application is fully loaded

  1. What is the use of $rootScope.$broadcast() method in AngularJS?
    a) To broadcast an event to all child scopes
    b) To broadcast an event to all parent scopes
    c) To broadcast an event to a specific scope

Answer: a) To broadcast an event to all child scopes

  1. What is $location service in AngularJS?
    a) A service to manipulate the URL
    b) A service to create controllers
    c) A service to create directives

Answer: a) A service to manipulate the URL

  1. What is the use of ng-bind-html directive in AngularJS?
    a) To bind text content to HTML
    b) To bind HTML content to a model
    c) To bind HTML content to HTML

Answer: b) To bind HTML content to a model

  1. What is the use of angular.module() method in AngularJS?
    a) To define a module
    b) To define a controller
    c) To define a directive

Answer: a) To define a module

  1. What is the purpose of ng-include directive in AngularJS?
    a) To include external HTML templates to AngularJS application
    b) To include JavaScript files to AngularJS application
    c) To include CSS files to AngularJS application

Answer: a) To include external HTML templates to AngularJS application

  1. What is the use of ng-bind-template directive in AngularJS?
    a) To bind text content to HTML
    b) To bind HTML content to a model
    c) To bind multiple expressions to a template

Answer: c) To bind multiple expressions to a template

  1. What is the use of ng-init directive in AngularJS?
    a) To execute code when an element is initialized
    b) To define a model property
    c) To bind HTML elements to a model

Answer: a) To execute code when an element is initialized

  1. What is $routeProvider in AngularJS?
    a) A service to define routes
    b) A service to define controllers
    c) A service to define directives

Answer: a) A service to define routes

  1. What is the use of ng-view directive in AngularJS?
    a) To define a view template
    b) To define a controller
    c) To define a directive

Answer: a) To define a view template

  1. What is the use of ng-class directive in AngularJS?
    a) To define a model property
    b) To bind HTML elements to a model
    c) to apply CSS classes dynamically

Answer: c) to apply CSS classes dynamically

  1. What is the use of $watch service in AngularJS?
    a) To watch for changes in a model property
    b) To create a new model property
    c) To define a dependency injection

Answer: a) To watch for changes in a model property

  1. What is the use of ng-form directive in AngularJS?
    a) To define a form element
    b) To define a model property
    c) To bind HTML elements to a model

Answer: a) To define a form element

  1. What is the use of $filter service in AngularJS?
    a) To create a new filter
    b) To apply a filter to an expression
    c) To define a module

Answer: b) To apply a filter to an expression

  1. What is the use of $timeout service in AngularJS?
    a) To set a timer
    b) To create a controller
    c) To define a directive

Answer: a) To set a timer

  1. What is the use of $locationProvider service in AngularJS?
    a) To configure the URL routing
    b) To create a new controller
    c) To define a new directive

Answer: a) To configure the URL routing

  1. What is the use of ng-message directive in AngularJS?
    a) To display error messages for form validation
    b) To display success messages for form validation
    c) To display warning messages for form validation

Answer: a) To display error messages for form validation

  1. What is the use of $httpBackend service in AngularJS?
    a) To mock HTTP requests for testing purposes
    b) To create a new HTTP request
    c) To create a new controller

Answer: a) To mock HTTP requests for testing purposes

  1. What is the use of $anchorScroll service in AngularJS?
    a) To scroll to a specific element in the page
    b) To create a new module
    c) To define a new directive

Answer: a) To scroll to a specific element in the page

  1. What is the use of ng-readonly directive in AngularJS?
    a) To make an input element read-only
    b) To make an input element writeable
    c) To remove an input element

Answer: a) To make an input element read-only

  1. What is the use of $compile service in AngularJS?
    a) To create a new directive
    b) To compile HTML templates
    c) To create a new filter

Answer: b) To compile HTML templates

Top 50 JavaScript Interview Questions with Answers

JavaScript Interview Questions with Answers
  1. What is JavaScript?

A. A programming language
B. A markup language
C. A web browser

Answer: A

  1. What is the output of console.log(“Hello” + 4)?

A. Hello4
B. TypeError
C. Hello

Answer: A

  1. Which one of the following is considered a falsy value in JavaScript?

A. null
B. NaN
C. undefined

Answer: A

  1. What is the difference between == and ===?

A. Both are the same
B. == only compares values, while === compares both values and data types
C. === only compares values, while == compares both values and data types

Answer: B

  1. What is an example of a higher-order function in JavaScript?

A. setTimeout()
B. console.log()
C. Math.random()

Answer: A

  1. What is the output of console.log(5 == “5”)?

A. true
B. false
C. undefined

Answer: A

  1. What is the output of console.log(typeof null)?

A. null
B. object
C. undefined

Answer: B

  1. What is the output of console.log([1, 2, 3] + [4, 5, 6])?

A. [1, 2, 3, 4, 5, 6]
B. 123456
C. NaN

Answer: B

  1. Which one of the following is an example of a JavaScript event?

A. click
B. div
C. span

Answer: A

  1. What is the output of console.log(+”5″)?

A. 5
B. “5”
C. TypeError

Answer: A

  1. What is the output of console.log(10%3)?

A. 1
B. 3
C. 0

Answer: A

  1. Which one of the following is a valid JavaScript variable name?

A. my-variable
B. my variable
C. myVariable

Answer: C

  1. What is the output of console.log(!”Hello”)?

A. false
B. true
C. “” (empty string)

Answer: B

  1. What is the output of console.log(5 + “5”)?

A. “55”
B. 10
C. TypeError

Answer: A

  1. What is an example of a JavaScript closure?

A. function add(x, y) { return x + y; }
B. function() { var x = 5; return function() { return x; } }
C. var x = 5; x++;

Answer: B

  1. What is the output of console.log(typeof undefined)?

A. undefined
B. null
C. object

Answer: A

  1. What is the output of console.log(Infinity – Infinity)?

A. NaN
B. Infinity
C. -Infinity

Answer: NaN

  1. What is the output of console.log(Math.floor(4.5))?

A. 4
B. 5
C. 4.5

Answer: A

  1. What is an example of a JavaScript constructor function?

A. function add(x, y) { return x + y; }
B. var obj = { name: “John”, age: 30 };
C. function Person(name, age) { this.name = name; this.age = age; }

Answer: C

  1. What is the output of console.log(Array.isArray({}))?

A. true
B. false
C. TypeError

Answer: B

  1. What is an example of a JavaScript callback function?

A. function add(x, y) { return x + y; }
B. setTimeout(function() { console.log(“Hello”); }, 1000);
C. var x = 5; x++;

Answer: B

  1. What is the output of console.log(Math.max([1, 2, 3]))?

A. 1
B. 2
C. 3

Answer: NaN

  1. What is an example of a JavaScript promise?

A. function add(x, y) { return x + y; }
B. new Promise(function(resolve, reject) { setTimeout(function() { resolve(“Hello”); }, 1000); });
C. var x = 5; x++;

Answer: B

  1. What is the output of console.log([“a”, “b”, “c”].splice(1, 1))?

A. [“a”, “c”]
B. [“b”, “c”]
C. “b”

Answer: B

  1. What is the output of console.log(“Hello John”.split(” “))?

A. “Hello John”
B. [“Hello”, “John”]
C. TypeError

Answer: B

  1. What is the output of console.log(20 + 30 + “40”)?

A. “2050”
B. “50”
C. TypeError

Answer: A

  1. What is the output of console.log(“Hello”.charAt(1))?

A. “h”
B. “e”
C. “l”

Answer: B

  1. What is an example of a JavaScript regular expression?

A. /hello/
B. function add(x, y) { return x + y; }
C. var x = 5; x++;

Answer: A

  1. What is the output of console.log(“Hello”.toUpperCase())?

A. “hello”
B. “HELLO”
C. TypeError

Answer: B

  1. What is the output of console.log([].constructor === Array)?

A. true
B. false
C. TypeError

Answer: A

  1. What is the output of console.log(“Hello”.replace(“l”, “x”))?

A. “Hexlo”
B. “Hxllo”
C. “Hello”

Answer: B

  1. What is the output of console.log(Math.ceil(4.1))?

A. 4
B. 5
C. 4.1

Answer: B

  1. What is an example of a JavaScript arrow function?

A. function add(x, y) { return x + y; }
B. var multiply = (x, y) => x * y;
C. var x = 5; x++;

Answer: B

  1. What is the output of console.log([1, 2, 3].map(x => x * 2))?

A. [2, 4, 6]
B. [1, 2, 3]
C. [4, 8, 12]

Answer: C

  1. What is the output of console.log(9 < 8 < 7)?

A. true
B. false
C. TypeError

Answer: A

  1. What is the output of console.log(“Hello”.length)?

A. 5
B. “Hello”
C. TypeError

Answer: A

  1. What is an example of a JavaScript IIFE (Immediately Invoked Function Expression)?

A. (function add(x, y) { return x + y; })(3, 4);
B. function() { var x = 5; return function() { return x; } }
C. function Person(name, age) { this.name = name; this.age = age; }

Answer: A

  1. What is the output of console.log(Math.round(4.4))?

A. 4
B. 5
C. 4.4

Answer: A

  1. What is the output of console.log(Math.random() * 10)?

A. A random number between 0 and 1
B. A random number between 0 and 10
C. A random number between 1 and 10

Answer: B

  1. What is the output of console.log([1, 2, 3].indexOf(2))?

A. 0
B. 1
C. 2

Answer: B

  1. What is the output of console.log(+”5″ + 5)?

A. 10
B. “10”
C. TypeError

Answer: A

  1. What is the output of console.log([“a”, “b”, “c”].indexOf(“d”))?

A. -1
B. 0
C. 1

Answer: A

  1. What is the output of console.log(“apple”.indexOf(“p”))?

A. 0
B. 1
C. 2

Answer: 1

  1. What is the output of console.log(“apple”.slice(1, 3))?

A. “ap”
B. “pp”
C. “pl”

Answer: C

  1. What is the output of console.log(“Hello”.substring(1, 3))?

A. “el”
B. “llo”
C. “He”

Answer: A

  1. What is the output of console.log([1, 2, 3].push(4))?

A. [1, 2, 3, 4]
B. [4, 3, 2, 1]
C. 4

Answer: C

  1. What is an example of a JavaScript generator function?

A. function add(x, y) { return x + y; }
B. function* generate() { yield 1; yield 2; yield 3; }
C. var x = 5; x++;

Answer: B

  1. What is the output of console.log(Math.min([1, 2, 3]))?

A. 1
B. 2
C. 3

Answer: NaN

  1. What is an example of a JavaScript async/await function?

A. function add(x, y) { return x + y; }
B. async function fetchData() { const response = await fetch(“http://example.com/data”); const data = await response.json(); return data; }
C. var x = 5; x++;

Answer: B

  1. What is the output of console.log([1, 2, 3].reverse())?

A. [1, 2, 3]
B. [3, 2, 1]
C. TypeError

Answer: B

Top 50 CSS Interview Questions with Answers

CSS Interview Questions with Answers
  1. What does CSS stand for?
    A. Creative Style Sheets
    B. Cascading Style Sheets
    C. Continuous Style Sheets
    D. Coordinated Style Sheets

Answer: B

  1. Which of the following is not a CSS property?
    A. font-style
    B. text-transform
    C. background-color
    D. image-radius

Answer: D

  1. What is the syntax for creating a CSS class?
    A. .class_name {}
    B. class_name {}
    C. #class_name {}
    D. ?class_name {}

Answer: A

  1. Which property is used to change the background color of an element?
    A. color
    B. background-color
    C. text-color
    D. none of the above

Answer: B

  1. Which property is used to add spacing between lines of text?
    A. line-height
    B. spacing
    C. letter-spacing
    D. none of the above

Answer: A

  1. What is the CSS box model?
    A. It is a way of describing how elements are displayed on a web page
    B. It is a way of describing the layout of a web page
    C. It is a way of describing the margins, borders, padding, and content of an element
    D. It is a way of describing the colors used on a web page

Answer: C

  1. What is the default display property of a element?
    A. block
    B. inline
    C. inline-block
    D. none of the above

Answer: A

  1. Which property is used to add a border to an element?
    A. border-style
    B. border-size
    C. border-color
    D. all of the above

Answer: D

  1. Which property is used to change the font of an element?
    A. font-family
    B. font-size
    C. font-style
    D. all of the above

Answer: A

  1. Which property is used to create a drop shadow effect on an element?
    A. text-shadow
    B. box-shadow
    C. element-shadow
    D. none of the above

Answer: B

  1. What is the default value of the position property?
    A. static
    B. relative
    C. absolute
    D. fixed

Answer: A

  1. Which property is used to change the opacity of an element?
    A. opacity
    B. transparent
    C. visibility
    D. none of the above

Answer: A

  1. Which property is used to create columns of text on a web page?
    A. column-gap
    B. column-count
    C. column-width
    D. all of the above

Answer: D

  1. What is the difference between padding and margin?
    A. Padding is the space between an element and its border, while margin is the space between an element and the next element
    B. Margin is the space between an element and its border, while padding is the space between an element and the next element
    C. Margin is the space between an element and a wall, while padding is the space between an element and a cushion
    D. Padding and margin are the same thing

Answer: B

  1. What is the difference between absolute and relative positioning?
    A. Absolute positioning positions an element relative to the viewport, while relative positioning positions an element relative to its parent element
    B. Absolute positioning positions an element relative to its parent element, while relative positioning positions an element relative to the viewport
    C. Absolute positioning positions an element in the center of the page, while relative positioning positions an element to the left or right of the page
    D. Relative positioning positions an element in the center of the page, while absolute positioning positions an element to the left or right of the page

Answer: A

  1. Which property is used to align text within an element?
    A. text-align
    B. text-justify
    C. text-indent
    D. all of the above

Answer: A

  1. What is the syntax for applying a style to a specific element?
    A. element style {}
    B. style element {}
    C. element {style}
    D. style {element}

Answer: C

  1. Which property is used to create an underline effect on text?
    A. underline
    B. text-underline
    C. text-decoration
    D. none of the above

Answer: C

  1. Which property is used to create a strikethrough effect on text?
    A. strike
    B. text-strike
    C. text-decoration
    D. none of the above

Answer: C

  1. Which property is used to create a bold effect on text?
    A. bold
    B. font-weight
    C. font-style
    D. none of the above

Answer: B

  1. Which property is used to create an italic effect on text?
    A. italic
    B. font-style
    C. text-style
    D. none of the above

Answer: B

  1. Which property is used to add an image as a background to an element?
    A. background-image
    B. image-background
    C. background-color
    D. all of the above

Answer: A

  1. Which property is used to control the amount of white space between words?
    A. word-spacing
    B. letter-spacing
    C. line-height
    D. none of the above

Answer: A

  1. Which property is used to add a gradient effect to an element?
    A. gradient-effect
    B. background-gradient
    C. linear-gradient
    D. none of the above

Answer: C

  1. Which of the following is not a valid value for the display property?
    A. block
    B. inline
    C. flex
    D. side

Answer: D

  1. Which property is used to create an outline around an element?
    A. outline-style
    B. outline-color
    C. outline-width
    D. all of the above

Answer: D

  1. Which property is used to change the size of an element?
    A. width
    B. height
    C. both a and b
    D. none of the above

Answer: C

  1. What is the difference between em and rem units?
    A. Em is relative to the font-size of the parent element, while rem is relative to the font-size of the root element
    B. Rem is relative to the font-size of the parent element, while em is relative to the font-size of the root element
    C. Em is a fixed size unit, while rem is a variable size unit
    D. Rem is a fixed size unit, while em is a variable size unit

Answer: A

  1. Which property is used to center an element horizontally within its container?
    A. text-align
    B. margin
    C. padding
    D. none of the above

Answer: A

  1. Which property is used to center an element vertically within its container?
    A. vertical-align
    B. text-align
    C. margin
    D. padding

Answer: A

  1. What is the difference between inline and block elements?
    A. Block elements take up the full width of their container, while inline elements only take up the space needed by their content
    B. Inline elements take up the full width of their container, while block elements only take up the space needed by their content
    C. Inline elements are always displayed in a single line, while block elements can be displayed in multiple lines
    D. Block elements are always displayed in a single line, while inline elements can be displayed in multiple lines

Answer: A

  1. Which property is used to add spacing between the border and the content of an element?
    A. padding
    B. margin
    C. border-spacing
    D. none of the above

Answer: A

  1. Which property is used to add an image to a web page?
    A. image-src
    B. img-url
    C. src
    D. all of the above

Answer: C

  1. Which property is used to create a transition effect on an element?
    A. transition
    B. transition-effect
    C. transition-duration
    D. all of the above

Answer: A

  1. Which property is used to create an animation effect on an element?
    A. animation
    B. animation-name
    C. animation-duration
    D. all of the above

Answer: A

  1. What is the difference between padding-left and padding-right?
    A. Padding-left adds space to the left of an element, while padding-right adds space to the right of an element
    B. Padding-right adds space to the left of an element, while padding-left adds space to the right of an element
    C. Padding-left and padding-right are the same thing
    D. None of the above

Answer: A

  1. What is the difference between CSS and HTML?
    A. CSS is used to style the layout of a web page, while HTML is used to structure the content of a web page
    B. HTML is used to style the layout of a web page, while CSS is used to structure the content of a web page
    C. CSS and HTML are the same thing
    D. None of the above

Answer: A

  1. Which property is used to change the color of text?
    A. color
    B. text-color
    C. font-color
    D. none of the above

Answer: A

  1. What is the difference between a class and an ID in CSS?
    A. A class can be applied to multiple elements, while an ID can only be applied to one element
    B. A class can only be used once, while an ID can be used multiple times
    C. A class is used for styling text, while an ID is used for styling images
    D. None of the above

Answer: A

  1. What is the difference between a pseudo-element and a pseudo-class in CSS?
    A. A pseudo-element is used to style a part of an element, while a pseudo-class is used to style a state or condition of an element
    B. A pseudo-class is used to style a part of an element, while a pseudo-element is used to style a state or condition of an element
    C. A pseudo-element and a pseudo-class are the same thing
    D. None of the above

Answer: A

  1. Which property is used to add a border-radius to an element?
    A. border-radius
    B. border-style
    C. border-size
    D. none of the above

Answer: A

  1. Which property is used to create a shadow effect on text?
    A. shadow-effect
    B. text-shadow
    C. shadow-text
    D. none of the above

Answer: B

  1. What is the difference between a child selector and a descendant selector in CSS?
    A. A child selector only selects direct children of an element, while a descendant selector selects all children of an element
    B. A descendant selector only selects direct children of an element, while a child selector selects all children of an element
    C. A child selector and a descendant selector are the same thing
    D. None of the above

Answer: A

  1. What is the difference between a relative and absolute unit in CSS?
    A. A relative unit is based on another value, while an absolute unit is a fixed value
    B. An absolute unit is based on another value, while a relative unit is a fixed value
    C. A relative unit and an absolute unit are the same thing
    D. None of the above

Answer: A

  1. Which property is used to create a vertical menu on a web page?
    A. vertical-menu
    B. menu-direction
    C. display
    D. none of the above

Answer: C

  1. What is the difference between a serif and sans-serif font?
    A. Serif fonts have decorative lines at the end of each character, while sans-serif fonts do not
    B. Sans-serif fonts have decorative lines at the end of each character, while serif fonts do not
    C. Serif and sans-serif fonts are the same thing
    D. None of the above

Answer: A

  1. Which property is used to create a gradient colored background on an element?
    A. background-gradient
    B. linear-gradient
    C. color-gradient
    D. none of the above

Answer: B

  1. Which property is used to create a transition effect on the color of an element?
    A. transition-color
    B. transition-style
    C. transition-duration
    D. none of the above

Answer: A

  1. What is the difference between min-width and max-width in CSS?
    A. Min-width sets the minimum width of an element, while max-width sets the maximum width
    B. Max-width sets the minimum width of an element, while min-width sets the maximum width
    C. Min-width and max-width are the same thing
    D. None of the above

Answer: A

  1. What is the difference between display: none; and visibility: hidden; in CSS?
    A. Display: none; removes the element from the page, while visibility: hidden; hides the element but keeps it in the page
    B. Visibility: hidden; removes the element from the page, while display: none; hides the element but keeps it on the page
    C. Display: none; and visibility: hidden; are the same thing
    D. None of the above

Answer: A

Top 50 Bash Scripting Interview Questions with Answers

Bash Scripting Interview Questions with Answers
  1. What does the “$” symbol represent in bash scripting?
    A) Comment
    B) Variable
    C) Function
    D) Command

Answer: B

  1. Which command is used to make a directory in bash scripting?
    A) cd
    B) ls
    C) mkdir
    D) touch

Answer: C

  1. What does the command “chmod” do in bash scripting?
    A) Changes ownership of a file
    B) Creates a new file
    C) Changes permissions of a file
    D) Deletes a file

Answer: C

  1. Which command is used to display the contents of a file in bash scripting?
    A) cat
    B) echo
    C) ls
    D) mkdir

Answer: A

  1. What is a shebang in bash scripting?
    A) A comment
    B) A variable
    C) A function
    D) A directive

Answer: D

  1. What is the purpose of an if statement in bash scripting?
    A) To create a loop
    B) To define a function
    C) To test a condition
    D) To display output

Answer: C

  1. Which command is used to remove a directory in bash scripting?
    A) rmdir
    B) rm
    C) mv
    D) ln

Answer: A

  1. What does the command “grep” do in bash scripting?
    A) Searches for a pattern in a file
    B) Creates a new file
    C) Displays the contents of a file
    D) Changes permissions of a file

Answer: A

  1. What is the purpose of a while loop in bash scripting?
    A) To create a loop
    B) To define a function
    C) To test a condition
    D) To display output

Answer: A

  1. How do you assign a value to a variable in bash scripting?
    A) Variable = value
    B) $Variable = value
    C) Variable : value
    D) $Variable : value

Answer: A

  1. Which command is used to move a file in bash scripting?
    A) cp
    B) rm
    C) mv
    D) ln

Answer: C

  1. What is the purpose of a for loop in bash scripting?
    A) To create a loop
    B) To define a function
    C) To test a condition
    D) To display output

Answer: A

  1. What does the command “echo” do in bash scripting?
    A) Searches for a pattern in a file
    B) Displays the contents of a file
    C) Changes permissions of a file
    D) Displays output

Answer: D

  1. Which command is used to copy a file in bash scripting?
    A) cp
    B) rm
    C) mv
    D) ln

Answer: A

  1. What is the purpose of a case statement in bash scripting?
    A) To test a condition
    B) To create a loop
    C) To define a function
    D) To display output

Answer: A

  1. What does the command “cd” do in bash scripting?
    A) Changes ownership of a file
    B) Creates a new file
    C) Changes to a different directory
    D) Deletes a file

Answer: C

  1. Which command is used to find the current working directory in bash scripting?
    A) pwd
    B) ls
    C) cd
    D) touch

Answer: A

  1. What is a function in bash scripting?
    A) A command that performs a specific task
    B) A variable that stores a value
    C) A conditional statement
    D) A loop

Answer: A

  1. What does the command “tee” do in bash scripting?
    A) Displays output
    B) Copies input to output
    C) Edits a file
    D) Moves a file

Answer: B

  1. What is the purpose of a do-while loop in bash scripting?
    A) To create a loop
    B) To define a function
    C) To test a condition
    D) To display output

Answer: A

  1. Which command is used to create a file in bash scripting?
    A) cp
    B) rm
    C) mv
    D) touch

Answer: D

  1. What does the command “sed” do in bash scripting?
    A) Searches for a pattern in a file
    B) Edits a file
    C) Displays the contents of a file
    D) Changes permissions of a file

Answer: B

  1. What is the difference between single and double quotes in bash scripting?
    A) Single quotes prevent variable expansion, double quotes don’t
    B) Double quotes prevent variable expansion, single quotes don’t
    C) There is no difference
    D) Both prevent variable expansion

Answer: A

  1. Which command is used to get the length of a string in bash scripting?
    A) strlen
    B) $length
    C) length
    D) expr length

Answer: D

  1. What does the command “wc” do in bash scripting?
    A) Edits a file
    B) Displays the contents of a file
    C) Counts the number of lines, words, and characters in a file
    D) Changes permissions of a file

Answer: C

  1. What is the purpose of the “shift” command in bash scripting?
    A) To delete variables
    B) To move variables to the left
    C) To move variables to the right
    D) To change variable values

Answer: B

  1. Which command is used to concatenate files in bash scripting?
    A) cp
    B) rm
    C) cat
    D) ln

Answer: C

  1. What is the purpose of the “export” command in bash scripting?
    A) To export variables to a new script
    B) To import variables from a script
    C) To delete variables
    D) To move variables to the left

Answer: A

  1. What does the “let” command do in bash scripting?
    A) Calculates the result of an expression
    B) Displays output
    C) Edits a file
    D) Moves a file

Answer: A

  1. What is a comment in bash scripting?
    A) A directive
    B) A variable
    C) A function
    D) Text that is ignored by the interpreter

Answer: D

  1. Which command is used to remove a file in bash scripting?
    A) mkdir
    B) rmdir
    C) rm
    D) ln

Answer: C

  1. What does the command “cut” do in bash scripting?
    A) Cuts a file into pieces
    B) Displays the contents of a file
    C) Edits a file
    D) Cuts out specific fields from a file

Answer: D

  1. What is the purpose of the “break” command in bash scripting?
    A) To exit a loop
    B) To enter a loop
    C) To continue to the next iteration of a loop
    D) To display output

Answer: A

  1. Which command is used to display the environment variables in bash scripting?
    A) printenv
    B) env
    C) set
    D) export

Answer: C

  1. What does the “continue” command do in bash scripting?
    A) Skips to the next iteration of a loop
    B) Exits a loop
    C) Enters a loop
    D) Displays output

Answer: A

  1. What is the purpose of the “read” command in bash scripting?
    A) Reads input from the user
    B) Displays output
    C) Edits a file
    D) Moves a file

Answer: A

  1. Which command is used to search for a file in bash scripting?
    A) find
    B) grep
    C) locate
    D) search

Answer: A

  1. What is the purpose of the “source” command in bash scripting?
    A) To execute a script within a script
    B) To import variables from a script
    C) To delete variables
    D) To move variables to the right

Answer: A

  1. Which command is used to compare two files in bash scripting?
    A) diff
    B) cmp
    C) comp
    D) compare

Answer: A

  1. What does the “declare” command do in bash scripting?
    A) Declares a variable
    B) Deletes a variable
    C) Moves a variable to the left
    D) Moves a variable to the right

Answer: A

  1. Which command is used to redirect the output of a command to a file in bash scripting?
    A) >
    B) <
    C) |
    D) &

Answer: A

  1. What is the purpose of the “sleep” command in bash scripting?
    A) To pause the script for a specified number of seconds
    B) To delete variables
    C) To move variables to the left
    D) To move variables to the right

Answer: A

  1. Which command is used to rename a file in bash scripting?
    A) mv
    B) cp
    C) ln
    D) rm

Answer: A

  1. What is the purpose of the “until” statement in bash scripting?
    A) To create a loop
    B) To test a condition
    C) To display output
    D) To define a function

Answer: A

  1. Which command is used to display the contents of a file backwards in bash scripting?
    A) cat
    B) tac
    C) bacy
    D) back

Answer: B

  1. What is the purpose of the “basename” command in bash scripting?
    A) To get the name of a file without the directory path
    B) To get the directory path of a file
    C) To get the length of a string
    D) To concatenate files

Answer: A

  1. Which command is used to display the top 10 lines of a file in bash scripting?
    A) head
    B) tail
    C) more
    D) less

Answer: A

  1. What is the purpose of the “cut” command in bash scripting?
    A) To cut out specific fields from a file
    B) To search for a pattern in a file
    C) To display the contents of a file
    D) To concatenate files

Answer: A

  1. Which command is used to sort the lines of a file in bash scripting?
    A) sort
    B) srt
    C) sor
    D) fsort

Answer: A

  1. What does the command “awk” do in bash scripting?
    A) Searches for a pattern in a file
    B) Edits a file
    C) Displays the contents of a file
    D) Analyzes and manipulates text files

Answer: D

Top 50 Nagios Interview Questions with Answers

Nagios Interview Questions with Answers

1) What is Nagios?
a) A network monitoring system
b) A database management system
c) A web server framework

Answer: a) A network monitoring system

2) Which protocol does Nagios use for monitoring?
a) SMTP
b) SNMP
c) FTP

Answer: b) SNMP

3) What is the main configuration file in Nagios?
a) nagios.cfg
b) nagios.conf
c) nagios.ini

Answer: a) nagios.cfg

4) How often does Nagios perform checks by default?
a) Every minute
b) Every 5 minutes
c) Every 15 minutes

Answer: b) Every 5 minutes

5) What is the command to verify the Nagios configuration files?
a) nagios -v
b) nagios -c
c) nagios -s

Answer: a) nagios -v

6) Which plugin is used for monitoring disk usage?
a) check_disk
b) check_cpu
c) check_memory

Answer: a) check_disk

7) Which plugin is used for monitoring network ports?
a) check_tcp
b) check_udp
c) check_http

Answer: a) check_tcp

8) What is the default port for Nagios web interface?
a) 80
b) 443
c) 8080

Answer: c) 8080

9) Which command is used to restart the Nagios service?
a) service nagios restart
b) systemctl restart nagios
c) restart nagios service

Answer: b) systemctl restart nagios

10) Which plugin is used for monitoring CPU usage?
a) check_cpu
b) check_memory
c) check_disk

Answer: a) check_cpu

11) Which plugin is used for monitoring memory usage?
a) check_memory
b) check_cpu
c) check_disk

Answer: a) check_memory

12) Which plugin is used for monitoring HTTP errors?
a) check_http
b) check_tcp
c) check_udp

Answer: a) check_http

13) Which plugin is used for monitoring ping response time?
a) check_ping
b) check_tcp
c) check_udp

Answer: a) check_ping

14) Which command is used to check the status of Nagios service?
a) service nagios status
b) systemctl status nagios
c) status nagios service

Answer: b) systemctl status nagios

15) Which file is used for defining host configurations in Nagios?
a) hosts.cfg
b) services.cfg
c) timeperiods.cfg

Answer: a) hosts.cfg

16) Which file is used for defining service configurations in Nagios?
a) services.cfg
b) hosts.cfg
c) timeperiods.cfg

Answer: a) services.cfg

17) Which plugin is used for monitoring DNS resolution?
a) check_dns
b) check_http
c) check_tcp

Answer: a) check_dns

18) Which plugin is used for monitoring SSH service?
a) check_ssh
b) check_scp
c) check_telnet

Answer: a) check_ssh

19) What is the command to check the version of Nagios?
a) nagios -v
b) nagios -V
c) nagios -version

Answer: b) nagios -V

20) Which plugin is used for monitoring MySQL database?
a) check_mysql
b) check_http
c) check_tcp

Answer: a) check_mysql

21) Which file is used for storing the log files in Nagios?
a) nagios.log
b) nagios.txt
c) nagios.dlog

Answer: a) nagios.log

22) Which plugin is used for monitoring Apache web server?
a) check_http
b) check_tcp
c) check_udp

Answer: a) check_http

23) Which plugin is used for monitoring FTP service?
a) check_ftp
b) check_sftp
c) check_tftp

Answer: a) check_ftp

24) Which file is used for defining time periods in Nagios?
a) timeperiods.cfg
b) hosts.cfg
c) services.cfg

Answer: a) timeperiods.cfg

25) What is the command to check the syntax of Nagios configuration files?
a) nagios -c
b) nagios -s
c) nagios -v

Answer: a) nagios -c

26) Which plugin is used for monitoring POP3 service?
a) check_pop
b) check_imap
c) check_smtp

Answer: a) check_pop

27) Which plugin is used for monitoring NFS service?
a) check_nfs
b) check_http
c) check_tcp

Answer: a) check_nfs

28) What is the command to check the status of Nagios services and hosts?
a) nagios -s
b) nagios -h
c) nagios -a

Answer: c) nagios -a

29) Which plugin is used for monitoring Active Directory service?
a) check_ad
b) check_ldap
c) check_http

Answer: b) check_ldap

30) Which file is used for defining contact groups in Nagios?
a) contactgroups.cfg
b) contacts.cfg
c) services.cfg

Answer: a) contactgroups.cfg

31) What is the command to check the uptime of a host in Nagios?
a) check_uptime
b) check_load
c) check_cpu

Answer: a) check_uptime

32) Which plugin is used for monitoring DNS server zones?
a) check_zone
b) check_dns
c) check_http

Answer: a) check_zone

33) What is the command to check the status of a specific service in Nagios?
a) check_service
b) check_status
c) check_snmp

Answer: c) check_snmp

34) Which plugin is used for monitoring PostgreSQL database?
a) check_postgres
b) check_mysql
c) check_http

Answer: a) check_postgres

35) Which file is used for defining command configurations in Nagios?
a) commands.cfg
b) services.cfg
c) timeperiods.cfg

Answer: a) commands.cfg

36) What is the command to check the network connectivity in Nagios?
a) check_network
b) check_snmp
c) check_ping

Answer: c) check_ping

37) Which plugin is used for monitoring NTP service?
a) check_ntp
b) check_http
c) check_tcp

Answer: a) check_ntp

38) What is the command to check the status of a specific host in Nagios?
a) check_host
b) check_status
c) check_cpu

Answer: a) check_host

39) Which plugin is used for monitoring Samba service?
a) check_samba
b) check_http
c) check_tcp

Answer: a) check_samba

40) Which file is used for defining hostgroup configurations in Nagios?
a) hostgroups.cfg
b) hosts.cfg
c) services.cfg

Answer: a) hostgroups.cfg

41) What is the command to check the status of a specific service group in Nagios?
a) check_servicegroup
b) check_status
c) check_snmp

Answer: a) check_servicegroup

42) Which plugin is used for monitoring RAID status?
a) check_raid
b) check_disk
c) check_cpu

Answer: a) check_raid

43) Which plugin is used for monitoring Windows services?
a) check_nt
b) check_snmp
c) check_http

Answer: a) check_nt

44) What is the command to check the free disk space in Nagios?
a) check_freedisk
b) check_memory
c) check_disk

Answer: c) check_disk

45) Which plugin is used for monitoring SSH logins?
a) check_sshlogin
b) check_ssh
c) check_telnet

Answer: a) check_sshlogin

46) Which file is used for defining servicegroup configurations in Nagios?
a) servicegroups.cfg
b) services.cfg
c) hosts.cfg

Answer: a) servicegroups.cfg

47) What is the command to check the network latency in Nagios?
a) check_latency
b) check_cpu
c) check_ping

Answer: a) check_latency

48) Which plugin is used for monitoring Exchange Server?
a) check_exchange
b) check_smtp
c) check_http

Answer: a) check_exchange

49) Which plugin is used for monitoring Oracle database?
a) check_oracle
b) check_mysql
c) check_http

Answer: a) check_oracle

50) Which file is used for defining user configurations in Nagios?
a) contacts.cfg
b) contactgroups.cfg
c) commands.cfg

Answer: a) contacts.cfg