Skip to content

Instantly share code, notes, and snippets.

@yasaswi-24
Last active May 13, 2024 16:32
Show Gist options
  • Save yasaswi-24/772a7eaaf3cf6ad19d4fb7fcebfdbc97 to your computer and use it in GitHub Desktop.
Save yasaswi-24/772a7eaaf3cf6ad19d4fb7fcebfdbc97 to your computer and use it in GitHub Desktop.

What will a function return if the return statement is not specified?

it returns undefined

What are the types of ownership in Linux?

user,groups,other

What are type errors, reference errors, and syntax errors?

syntax errors-if we not follow the rules type errors - redeclaring of const variable gives type errors reference errors-trying to access before declaring

What is the difference between 'var' and 'let'?

var is function scope let is block scope

What is global scope?

global variables can be accessed from any where

What is the difference between 'cd ..' and 'cd /'?

cd .. -goes to previous directory cd/ goes to root directory

What is the difference between 'for...in' and 'for...of' loops?

for in for objects for of for arrays

What is the difference between 'forEach' and 'map'?

forEach does not return but console map returns new array

What is the use of the 'splice' method?

to add or delete or repalce existing we use splice

What is the difference between primitive and non-primitive data types?

primitive means basic data types and immutable non primitive are array,objects and are mutuable

What is a callback?

calling function as an argument

How do you export multiple functions?

using {} ex:{matches,deliveries}

How do you rename a file using a CLI command?

mv filename1 filename2

What are the different parameters used in the 'reduce' method?

accumulator,currentvalue

What is 'git commit'?

to commit the files

How many stages are there in Git?

3stages untracked,staging,commited

How do you check hidden files in a directory?

ls -a

Why do we use the 'filter' function?

it gives satisfied conditions objects

What is the difference between call by value and call by reference?

call by value-it creates new memory and does not effect original one call by reference - original one gets effected

What is the difference between '==' and '==='?

== does not checks data type whereas === checks data type

What are the non-primitive data types?

array,objects

What is the difference between a normal function and an arrow function?

normal function with function keyword and arrow function without function keyword and used => this symbol

What is the difference between 'splice' and 'slice'?

slice to get the certain range splice is add,remove or replace elements

What are the different parameters of the Error object?

message ,name

What is meant by lexical scope?

parent scope variables can be accessed function scope

What is 'pgrep'?

process ids are retrieved

Why do we use 'const'?

when we want not to change the value then we use const

What are closures?

function inside a function is called closures

What is the return type of the 'reduce' method?

either object or array or single value as per requirement

When will a merge conflict arise?

when having same file names with different content in it

What are 'split' and 'join'?

split to divide the string as needed and join is used to combine by space or - etc

What is the temporal dead zone?

between the declaration and assignment

What will 'Object.keys(string)' do for a string?

returns index

How do you check if a local repository is connected to a remote repository?

git remote -v

What is the usage of the 'forEach' loop?

to access every element ,return is not possible, by using console we get data.

What is the difference between parameters and arguments?

parameters is used for function declaration and arguments used for calling function

What is the difference between 'throw' and 'throw Error'?

throws - It throws any value throw Error - throws errors

What is the difference between shallow copy and deep copy?

shallow copy upadating new one effects original one deep copy does not effects original one it creates new memory

What is 'git stash'?

temporarily stores changes

What is the 'every' method?

it checks every element if condition satified returns true othrwise false

What is the difference between 'push' and 'pop' methods?

push -elements added at end pop-remove elements from end

What is a higher-order function? It takes one or more functions as arguments and returns functions

What is the use case of [incomplete question]? What is the 'for...of' loop? for arrays,strings to iterate and access we use for of ,it is iterable function

Why do we use 'sudo'?

it enables permission of user

What is the use of 'git fetch'?

To download data from remote repository

What is the command to commit changes?

git commit -m "message"

What is the difference between 'copy' and 'move'?

copy means to copy contents from one file to other and move is to move from one directory to other

Can we access the characters of a string without using 'charAt()'?

by using index

#What is the scope of 'let', 'var', and 'const'? let and const are block scope var is function scope

#What are template literals? backticks ,represent as multiline string without using \n

#What is the 'indexOf' method? gives the index of charcter in the string and it gives the index of element of array

#What is the return type of 'map'? creates new array object

#What are the disadvantages of shallow copy? The original object also it effects so that sometimes it may be lead unexpected behaviour

What is the difference between 'shift()' and 'unshift()'?

shift()-delete the first element of array unshift()-add the element to first position of array

Why do we use the 'curl' command?

to find public ip address

What is the difference between global and local scope?

global scope-we can access the variables from anywhere if we declared globally local scope - we can only access variable to that block only if we declared locally

How do you check if Git is initialized?

git init

What is the command for creating a branch?

git branch branchname

What happens if a function does not have a return statement?

It gives undefined

What is the spread operator?

If we want to pass the unknown number of arguments then we use spread operator ,representation of spread operator(...)

What is 'NaN'?

NaN is not a number ,It represents not a valid number and used to check whether number is valid or not

What is the use of the 'tree' command?

to get structure of directory

What is the difference between '.entries()' and '.fromEntries()'?

.entries()-used to convert object to array .fromEntries()-used to convert array to object

What is the use of the piping operator?

it takes output from previous one as input and process and gives output

What is the difference between mutable and immutable methods?

mutuable methods - they modify the arrays -examples:push(),pop() immutable methods- they do not modify arrays but craetes new array -examples:map(),filter()

What are the different types of creating a copy of an array?

Array.from(),spread operator,slice() etc

What are the permissions in Linux?

read-only to read file-4 write-to modify the data or include data-2 execute-to execute-1

What is the difference between 'git rebase' and 'git merge'?

git merge-combining changes from one branch to another branch git rebase-moving changes from one branch onto other branch

What is 'Array.find()'?

It gives the first element which statisfies condition,if no element satisfies it gives undefined

How many types of loops are there in JavaScript?

for in,for of,while

What is the return type of 'forEach'?

no return type

How do you check the current directory?

pwd

What is the 'typeof' function?

it gives type for ex let n=3 => o/p:number

What is 'JSON.stringify()'?

It converts into string

What is a two-level closure?

closure defined inside closure nothing but nested closure

What will be the output for traversing an array with empty elements?

no effect,it goes to next elemnt

What is the command to show branches in a repository?

git branch

Why do we use 'grep'?

to search for the specific content

What is the command to edit the previous commit?

git reset

What does 'Object.entries()' return?

key value pairs as array

What is pass by value and pass by reference?

passbyvalue- it will not effect the original one it creates the memory passbyreference-it will effect original array

What is the 'new' keyword in JavaScript?

create new instance of object

What is hoisting in JavaScript?

we can give console before declaring it gets undefined for var but for let it gets error

How do you convert a string of any base to a number?

parseInt()

What is the use of 'log' in Git?

to check commit history

Where is the 'reduce' method used?

to get single value output

What happens if 'for...of' is used on objects?

it should convert to array and then we can use it

What is 'Object.assign()'?

to copy objects from one source to other object.assign(target,source)

How do you check if a value is a number?

isNumber()

What is the command to close a process?

pkill

What are the blocks of error handling?

try catch try catch finally

What is the use of the 'netstat' command?

to get all ports

How can we resolve merge conflicts?

by manually opening the text file

What is an ASCII value?

for every character we having ascii value to get it charcodeAt()

What is the command to create a file?

touch or cat

What is the 'ping' command?

network connectivity

What is variable hoisting?

we can access the variable before declaring

Which command is used to start a Node.js project?

npm start

What is JSON?

data representation javascript object notation

What is meant by block scope?

within the code block

What are the different types of primitive data types?

number,string,boolean,Nan,undefined

What is the type of 'undefined'?

undefined

What is the use of the 'find' method?

it gives the value of satisfied condition

What is the 'include' method?

it check whether it is present or not,returns true or false

What is the difference between 'null' and 'undefined'?

assign null to variable ex:let a= null undefined gets when not assigned value

What is the use of the 'trim()' method?

to remove the spaces from first and last

What is the difference between 'undefined' and 'not defined'?

if value not assigned is undefined if not declared any variable

What are some examples of mutable methods?

push(),pop() -- we can change

How many types of operators are there in JavaScript?

7-->logical,assignment,ternary,bitwise,arthimetic,comparision,string

What is the ternary operator?

single conditional statement -condition ?truth value:falsevalue

What happens when we throw an object?

return object

How do we create a deep copy?

JSON.parseInt(JSON.stringify(name))

What is pass by value?

it creates new memory it does not effect the original one

How do you initialize an object and access its values?

{},dot(.) operator

What is the use case of the 'substring' method?

to get the range of sentence (start,stop)

Which command is used to get the IP address of a website?

nslookup

Is JavaScript synchronous?

yes because it is single thread

What will the 'git status' command do?

to give status of current working directory

What is the difference between 'array.filter' and 'array.map'?

map returns an new array filter returns new array of all satisfied condition

How do you change file permissions using a command?

chmod

What is the 'find' command in CLI?

it gives the path of file which we given

How do you sort a number array?

sort() ex:let n=[4,5,2] n.(sort(a,b)=>(a-b))

What is shallow copy?

to craete new one which will effect original if cahnges or done

What are the uses of 'shift' and 'unshift' methods?

shift-to delete the first element unshift - to add element to first position

Is JavaScript multithreaded or single-threaded?

single threaded

What is 'git init'?

to initialize empty repoistory

What is the use of 'array.join()'?

to join two or more strings by using space,or any symbols we want

Why do we call JavaScript single-threaded?

because it is synchronous

What are the arguments for the 'reduce' function?

accumulator,currentvalue

How will you sort an object according to its values?

callback function sort(a,b)=>a[1]-b[1]

How do you change file permissions using numbers?

chmod 745 filename

When do we use the 'chmod' command?

when we want to change the permissions of file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment