Skip to content

Commit 0ba233b

Browse files
committed
most html
1 parent 1988436 commit 0ba233b

1 file changed

Lines changed: 206 additions & 0 deletions

File tree

JavaScript Interview/inter.js

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/*
2+
3+
1.What is HTML?
4+
Ans: HTML stands for Hyper Text Markup Language.
5+
It is used to design web pages using a markup language. HTML is the combination of Hypertext and Markup language.
6+
Hypertext defines the link between the web pages. A markup language is used to define the text document
7+
within tag which defines the structure of web pages.
8+
2. Semantic Tags in HTML
9+
Ans: Semantic elements = elements with a meaning.
10+
A semantic element clearly describes its meaning to both the browser and the developer.
11+
Examples of non-semantic elements: <div> and <span> - Tells nothing about its content.
12+
Examples of semantic elements: <form>, <table>, and <article> - Clearly defines its content.
13+
3. four exmples of semantic tags
14+
Ans: <article>, <aside>, <details>, <figcaption>, <figure>, <footer>, <header>, <main>, <mark>, <nav>, <section>, <summary>, <time>
15+
16+
4.apart from meaning to browser does semantic elements help other way?
17+
Ans: Yes, it helps in SEO(Search Engine Optimization) and Accessibility.
18+
19+
5. what are tags & attributes?
20+
Ans: Tags are the basic component of HTML. It is used to create HTML elements.
21+
Attributes provide additional information about the element. It is always specified in the start tag.
22+
example: <a href="https://www.google.com">Google</a> here href is an attribute.
23+
and <a> is a tag.
24+
6. difference between div and span?
25+
Ans: div is a block element and span is an inline element.
26+
27+
7. examples of inline elements.
28+
Ans: <a>, <b>, <span>, <img>, <input>, <label>, <select>, <strong>, <textarea>
29+
8. apart from width difference is there sny other differnce?
30+
31+
9. can we give height & width in inline elements?
32+
Ans: No, we can't give height and width to inline elements.
33+
10. diff between canvas and nsvg
34+
Ans: Canvas is a container used to draw graphics on the web page using JavaScript.
35+
11. full form of css
36+
Ans: Cascading Style Sheets
37+
12. tell meaning of cascading in css
38+
Ans: Cascading means the process of combining multiple style sheets and resolving conflicts between them.
39+
13. if we give some styling to parent will it apply on the child also?
40+
Ans: Yes, it will apply to the child also.
41+
14. what is specificity?
42+
Ans: Specificity is the process of determining which CSS rule will be applied by the browser.
43+
15. default value of position property
44+
Ans: static
45+
16. difference between position relative and absolute
46+
Ans: Relative: It is positioned relative to its normal position.
47+
Absolute: It is positioned relative to the nearest positioned ancestor.
48+
17. what is flexbox?
49+
Ans: Flexbox is a layout model used to design a responsive web page.
50+
18. if we have a container and inside container there are two elements span 1 and span2 & we give display:
51+
flex to parent will it apply to its children as well?
52+
Ans: Yes, it will apply to its children also.
53+
54+
19. what is box model in css?
55+
Ans: The CSS box model is a container that contains multiple properties including borders,
56+
margin, padding, and the content itself.
57+
20. default value of box-sizing?
58+
Ans: content-box
59+
21. diff in content box border box?
60+
Ans: Content Box: It includes only the content.
61+
Border Box: It includes content, padding, and border.
62+
22. why do we need javascript ?
63+
Ans: JavaScript is used to design interactive web pages. It is used to validate the form, create cookies,
64+
and detect the browser.
65+
23. what are different data types in javascript?
66+
Ans: Number, String, Boolean, Object, Null, Undefined
67+
24. why do we have categories like premetive and non premitive in JS?
68+
Ans: Primitive data types are immutable and non-primitive data types are mutable.
69+
primitive data types example: Number, String, Boolean, Null, Undefined
70+
non-primitive data types example: Object, Array, Function
71+
25. in how many ways we csn create variabls in JS?
72+
Ans: var, let, const
73+
26. diff b/w let and var and there scope?
74+
Ans: Var: It is function scoped.
75+
Let: It is block scoped.
76+
const: It is block scoped.
77+
27. diff b/w parameter and argument?
78+
Ans: Parameter: It is a variable in the declaration of the function.
79+
Argument: It is the actual value of the variable.
80+
81+
28. difference b/w slice and splice methods?
82+
Ans: Slice: It returns the selected elements in an array.
83+
Splice: It adds or removes the elements in an array.
84+
85+
29. why do we use map method in array?
86+
Ans: The map() method is used to iterate over an array and modify the elements in the array.
87+
88+
30. what are promises in javascript?
89+
Ans: Promises are used to handle asynchronous operations in JavaScript.
90+
syntax: new Promise((resolve, reject) => { // code })
91+
31. what is DOM?
92+
Ans: Document Object Model is a programming interface for web documents. It represents the structure of the document.
93+
94+
32. EVENT BUBBLING & CAPTURING
95+
Ans: Event bubbling: It starts from the target element and bubbles up to the parent element.
96+
Event capturing: It starts from the parent element and goes down to the target element.
97+
98+
33. why do we need React?
99+
Ans: React is used to design single-page applications. It is used to create reusable UI components.
100+
101+
34. diff b/w imperative and declarative?
102+
Ans: Imperative: It tells how to do something.
103+
Declarative: It tells what to do.
104+
105+
35. what is concept of state in React?
106+
Ans: State is used to store the data in the component. It is mutable.
107+
and changes in state will re-render the component.
108+
109+
36. why dont we use normal variable why state?
110+
111+
ans: Normal variables are immutable and state is mutable.
112+
113+
37. GUESS OUTPUT::
114+
var x=20
115+
function foo(){
116+
console.log(x)
117+
var x=10
118+
}
119+
foo()
120+
// if change x=10 to let x=10 what will happen?
121+
122+
123+
ans : it will give reference error x is not defined
124+
125+
126+
38. console.log('Start')
127+
setTimeout(()=>{
128+
console.log('timeout')
129+
},0)
130+
console.log('End')
131+
//the order in which it will run?
132+
133+
134+
ans: Start, End, timeout
135+
136+
137+
39. setTimeout(()=>{
138+
console.log('timeout')
139+
},0)
140+
Promise.resolve().then(()=>console.log('Promise'))
141+
console.log('End')
142+
143+
ans: End, Promise, timeout
144+
145+
40. async funtion foo(){
146+
return 'Hello World'
147+
}
148+
const result = foo()
149+
console.log(result)
150+
151+
ans: Promise {<resolved>: "Hello World"}
152+
153+
41. [1,2]==[1,2]
154+
155+
ans: false
156+
157+
158+
42. const user1={
159+
name: 'john',
160+
age:25,
161+
address:{
162+
city:'Mumbai',
163+
state:'Mahrashtra'
164+
},}
165+
const user2 = user1
166+
user2.name = 'Ramesh'
167+
user2.address.city='Pune'
168+
console.log(user1)
169+
console.log(user2)
170+
171+
ans: {name: "Ramesh", age: 25, address: {city: "Pune", state: "Mahrashtra"}}
172+
173+
174+
43. const numbers= [0,1,2,3,4,5,6] //filter out all values less than 3
175+
ans: numbers.filter(num=>num<3)
176+
177+
44. create a string variable add a string in lowerCase and convert first letter of each to
178+
uppercase OR can you transform it into array.
179+
ans: let str = 'hello world'
180+
str.split(' ').map(word=>word.charAt(0).toUpperCase()+word.slice(1)).join(' ')
181+
console.log(str)
182+
OR
183+
184+
45. PROJECT:: create a TODO list in which there will be input and add button delete also
185+
ans: <input type="text" id="todo" placeholder="Enter your todo">
186+
<button onclick="addTodo()">Add</button>
187+
<ul id="todos"></ul>
188+
<script>
189+
function addTodo(){
190+
const todo = document.getElementById('todo').value
191+
const li = document.createElement('li')
192+
li.textContent = todo
193+
document.getElementById('todos').appendChild(li)
194+
}
195+
</script>
196+
46. what is the difference between == and === in JS?
197+
Ans: == compares only the value.
198+
=== compares the value and type.
199+
47. what is the difference between null and undefined?
200+
Ans: Null: It is an assigned value. It means nothing. it is an object.
201+
it assigned to a variable as a representation of no value.
202+
Undefined: It is a type of variable. It is assigned to a variable that has not been assigned a value.
203+
204+
205+
206+
*/

0 commit comments

Comments
 (0)