Yesterday, I attended a mock interview as part of my web development learning journey. The session mainly focused on JavaScript fundamentals, programming concepts, and basic HTML/CSS topics. It was a valuable experience because it helped me understand the areas where I am confident and the topics I need to revise further.
The interviewer started with a simple self-introduction and then gradually moved into technical questions. Although some questions seemed easy at first, they tested my understanding of core concepts rather than memorized definitions.
Questions:
- Tell me about yourself
- What is VCS?
- What is type casting?
- Primitive Vs non primitive?
- Operators in javascript?
- What is ternary operator?
- Switch statement?
- NULL vs Undefined?
- Variable scope?
- % vs Vh,vw?
- Relative & Absolute?
Answers:
- A Version Control System (VCS) is a tool that helps developers track, manage, and organize changes made to source code over time. It allows multiple developers to work on the same project without overwriting each other's work and provides the ability to revert to previous versions if needed.
Why is VCS Important?
Tracks changes in code.
Maintains a history of modifications.
Enables collaboration among team members.
Helps recover previous versions of files.
Supports branching and merging for feature development.
- Type casting is the process of converting one data type into another. It can be:
Explicit (manual conversion using Number(), String(), Boolean())
Implicit (automatic conversion by JavaScript)
- Primitive Data Types
String
Number
Boolean
Undefined
Null
Symbol
BigInt
Non-Primitive Data Types
Object
Array
Function
Primitive values are immutable, whereas non-primitive values are reference-based.
- The interviewer asked about different types of operators:
Arithmetic Operators (+, -, *, /, %)
Assignment Operators (=, +=, -=)
Comparison Operators (==, ===, !=)
Logical Operators (&&, ||, !)
Ternary Operator (? :)
- The ternary operator is a shorthand version of an if...else statement.
let age = 18;
let result = age >= 18 ? "Adult" : "Minor";
console.log(result);
- A switch statement executes different code blocks based on matching cases.
let mark = 35;
switch(mark>=35){
case true:
console.log("Pass");
break;
case false:
console.log("Fail");
break;
}
NULL: Intentionally assigned empty value
Undefined: Variable declared but not assigned.The interviewer asked about scope in JavaScript.
Global Scope
Function Scope
Block Scope
var is function-scoped, while let and const are block-scoped.
%: Relative to the parent element.
Eg.width: 50%;
vh: Relative to browser height.
Eg. height: 100vh;
vw: Relative to browser width.
Eg. width: 100vw;Relative: Positioned relative to its normal position.
Eg.
position: relative;
top: 20px;
Absolute: Positioned relative to the nearest positioned parent.
Eg.
position: absolute;
top: 20px;
left: 20px;
The mock interview was a valuable learning experience. It helped me identify my strengths and areas for improvement. While I was able to answer several questions confidently, I also found topics that require more practice. Overall, the experience boosted my confidence and motivated me to continue improving my web development and JavaScript skills.
Top comments (0)