{"id":20076255,"url":"https://github.com/aakashdeveloper/randominterview","last_synced_at":"2025-06-16T08:34:14.980Z","repository":{"id":251646844,"uuid":"817429400","full_name":"Aakashdeveloper/randominterview","owner":"Aakashdeveloper","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-11T13:21:40.000Z","size":225,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T14:28:02.652Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Aakashdeveloper.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-19T17:29:04.000Z","updated_at":"2025-03-11T13:21:45.000Z","dependencies_parsed_at":"2025-03-02T12:42:17.593Z","dependency_job_id":"2cea09a9-755e-4470-84e5-ea1e20d2ae3b","html_url":"https://github.com/Aakashdeveloper/randominterview","commit_stats":null,"previous_names":["aakashdeveloper/randominterview"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Aakashdeveloper/randominterview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aakashdeveloper%2Frandominterview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aakashdeveloper%2Frandominterview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aakashdeveloper%2Frandominterview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aakashdeveloper%2Frandominterview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aakashdeveloper","download_url":"https://codeload.github.com/Aakashdeveloper/randominterview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aakashdeveloper%2Frandominterview/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260126652,"owners_count":22962669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T15:02:00.872Z","updated_at":"2025-06-16T08:34:14.967Z","avatar_url":"https://github.com/Aakashdeveloper.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"given a 1-indexed array of integres\nthat is already sorted in non -descresing\nnumbers be  numbers[index1] and numbers[index2] \nwhere 1\u003c= index1\u003c index2\u003c= numbers.length\n\nreturn the indices of two number index1 and index2 added by one as\nan integre array [index1,index2] of length 2\n\nexample1\ninput [2,7,11,15]\ntarget = 9\nreturn [1,2]\n\nexample2\ninput [2,3,4]\ntarget = 6\nreturn [1,3]\n\n\nfunction calc(job){\n    var income = 5\n    if(job){\n        var income = 50\n    }\n    {\n        var income = 500\n    }\n    {\n        var income = 5000\n    }\n    return income\n    \n}\n\nconsole.log(calc(true))\n\n\nlet arra [\n    {user:'Sateesh\", addess:\"Hyd\", count:10},\n    {user:'Ranjith\", addess:\"Hyd\", count:11},\n    {user:'Mahes\", addess:\"Hyd\",, count:12}\n]\n\n\nasync function(req,res){\n    try{\n        const a = await someFunctin()\n         const b = await someFunctin1()\n         res.send('ok')\n    }\n    catch(error){\n        res.error()\n    }\n}\n\npython\nfind all duplicate in an array of integeres\nevery integer only appers once or twice\nwe need to find which apper twice\ninput \u003e [4,3,2,7,8,2,3,1]\noutput \u003e [2,3]\n\njavascript \ngiven a number n write a function that return the total number of primes up to and including n\nex \nn = 5 and result should be 3\nn = 0 and result should be 0\nn = 100 and result should be 24\n\n\nfetch data from url and display data in table in vuejs\n\n\ndisplay in angular tempalate variable fee\nif there are less than two digit for integer part of the the percent you have to display leading zeros\nif theere are ess than two decimal digit you have to display trallig zeros\nif there are more than three decimal digits you need have round to the 3 digts\n\n\namount div\nif there are less than 9 digit for the integer part of the amount you need to display leading zeros the number\nhave to be separated after every thrid digit with comma\nif there are  less than 2 decimal digit you have to display\ntrailing zero and if there are more you have to round value to 2 decimal\n\npublic class A{\n    private A instance\n    private List\u003cString\u003e items;\n\n    pubic void setList(String[] items) {\n        this.items = items\n    }\n\n    public void getSize() {\n        this.items.size()\n    }\n\n    public boolean isAvailable(string search){\n        for(int item: items){\n            if(item == search){\n                return true\n            }\n        }\n    }\n\n    public statuc A getInsatnce(){\n        if(instance ==null){\n            return new A()\n        }\n        return instace\n    }\n\n    Sting toString(){\n        return \"text1\"\n    }\n}\n\nfind the longest palindrome substring word\nis banana javascript\n\n\nstart by creating a composable function. Start with useToggle\n\n\n    \u003cscript\u003e\n\n    /*implement composable function that toggle the state \n        use useRef and state in vuejs*/\n        function useToggle(){\n\n        }\n\n        const [state,toggle] = useToggle(false)\n    \u003c/script\u003e\n\n   \n\n    \u003ctempalate\u003e\n    \u003cp\u003eState:{{state?'ON':'Off'}}\u003c/p\u003e\n    \u003cp @click=\"toggle\"\u003e\n    toggle\n    \u003c/p\u003e\n    \u003ctemplate\u003e\n\n\nvar studs = [{\n    name:'a',\n    age:12,\n    marks:70,\n    roll:1\n},\n{\n    name:'b',\n    age:12,\n    marks:35,\n    roll:2\n},\n{\n    name:'c',\n    age:12,\n    marks:3,\n    roll:3\n},\n{\n    name:'d',\n    age:12,\n    marks:45,\n    roll:2\n}]\n\nwe need to convert into object\nwhere key will be roll and value is marks\nif roll number is repeated add all marks for that roll number\n\njavascript\ngiven a tree we want the value of tree node associated with level \nreturn in which tree node is present\nalong with the level \n\n(function(){\n    var a = b = 3\n})()\n\n\nconsole.log(\"b defined? \"+(typeof b !== 'undefined'))\n\nhttps://jsonplaceholder.typicode.com/posts\ncall api in angular service using observable\n\nnow in html give me submit button and show two way data binding\n\nnodejs\ncreate a POST  endpoint /maxProfit to find the max profite\nthat can be obtained  by buying or selling share\nthe endpoint accept a JSON body\nwith an array of n integres represent the price\nof the stock on n consecutive day \n\nthe endpoint shoukd return JSON\nmax Profit \u003ema xprofite obtained by buying and selling stocks\ntransction \u003e array iof tuples represting the buy an sell days that leading\nto the max profite\neach tuple should contain two integeres represnt the zero-indexed day numbers\n\nRequestBody\n{\n    \"price\":[7,1,5,3,6,5]\n}\n\nResponse\n{\n    \"maxProfit\":7,\n    \"transction\":[\n        {\n            buy:1,\n            sell:5\n        },\n        {\n            buy:3,\n            sell:6\n        }\n    ]\n}\n\ngolang \nwrite a code that concurrently fetches the page content\nof the provided url and count the instance of the word \"Oz\"\n\n\ntask 1: Add a comment to the count function explaining what it does\n\nvar {\n    url = [] string{\n        \"htt1\",\n        \"htt2\",\n        \"htt3\",\n\n    }\n}\n\nfunc main(){\n    fmt.Println(\"done\")\n}\n\nfunc count(url string)(int, error){\n    res, err := http.Get(url)\n    if err != nil{\n        return 0, count\n    }\n    defer res.Body.Close()\n    body := bufio.NewReder(res.Body)\n    count :=0;\n    for{\n        m := pattern.FindRenderIndex(body)\n    }\n}\n\n\nvar myobj ={\n    foo:'bar',\n    \n    func:function(){\n        var self = this;\n        console.log('outer func'+this.foo)\n        console.log('outer func'+self.foo)\n        (function(){\n            console.log('inner func'+this.foo)\n            console.log('inner func'+self.foo)\n        }())\n    }\n   \n}\n\n\nthis code cause stackOverflo if arrat\nvar list = readHugeList()\nvar nextListItem = function(){\n    var item = list.pop()\n    if(item){\n        //process the list item\n    nextListItem()\n    }\n}\n\njavascript\n\ngiven a linked list swap every two adjcent nodes and return\nits head.\nyou may not modify the value in the list nodes, only nodes itself may be changes\n\nexample1\ninput 1-\u003e2-\u003e3-\u003e4\n\noutput 2-\u003e1-\u003e4-\u003e3\n\n\njavascript\nexample Input 1(currencies and conversion rates)\nUSD, GBP, 0.69 (means USD=GBP*0.69)\nGBP, JPY 140 (means GBP=JPY*140,0)\n\nexample Input 2(quires)\nUSD, GBP, 0.69\nGBP, JPY -\u003e USD = GBP*0.69= JPY*140.0*0.69=JPY*(140.0*0.69)= JPY*96.6 -\u003e 96.6\n\nwrite function that is able to calculat ethe conversion rat eof every query in input2\nLike (USD,CNY)\n\n\n\njavascript\nreturn the string\ninput  \u003e uoy-era-woh\noutput\u003e How are you\n\nsql\n\nwrite a query the fetch the 2nd \nhighest salaery from each dept\n\ntable sturtcure\ndept id | dept | name | salary\n\npython \ninput = \"bcabc\"\noutput = \"bca\"\nremove duplicate form string\n\nsimple login page with typescript\n\n.class-a{\n    color:green\n}\n\n.class-b.class-a{\n    color:green\n}\n\njavascript\n\nwrite a function \n    accept a string return a function that\n        return the string that was passed in\n\nhtml and css\nbuild up a page layout \nheader on top \nfooter at always content\nin between we have content\nif content is large make is scrollable and\nscrollbar should be between content \ndo not scroll header and footer\n\njavascript\n\nfunction getData(number){\n    var a = 0;\n    let b = 0;\n    const c = 0;\n    if(number \u003e 5){\n        var a = 1;\n        let b = 1;\n        const c = 1;\n    }\n\n    return [a,b,c]\n}\ngetData(7)\n\n\nvar x = 21;\nvar girl = function(){\n    console.log(x);\n    x = 20;\n}\ngirl()\n\n\nfunction sum(){\n    var a = 3;\n    return function(b){\n        console.log(a+b)\n    }\n}\n\nvar fn = sum()\nconsole.log(fn(2))\n\njavascript\nwrite function getTotal which will return sum of all argment\ngetTotal(2,3,4,5)(4,5,6)\n\njavascript\n\nsetTimeout(() =\u003e {\n    console.log('1');\n},0)\n\nnew Promise((resolve) =\u003e {\n    console.log('2')\n    resolve()\n}).then(() =\u003e {\n    console.log('3')\n})\n\nconsole.log(4)\n\nqueueMicroTask(() =\u003e {\n    console.log('5')\n})\n\nnew Promise((resolve,reject)=\u003e{\n    reject(\"6\")\n}).catch(console.log)\n\n\nwrite function in typescript\nwhen we either pass string of number argumnet\nif pass string as argument then it should return \nstring or if we pass number as argumnent\nthen it shoudl return number\n\n\nwrite function which will return most repeated number in an array with its count{5:4}\nconst input = [2,5,2,[5,4,[5,6[5,6]]]]\noutput :{5:4}\n\nreact\nA list of color composed of \"red\" and \"green\" element\nA \"square\" component that renders a square of a given color and executes a click method\nimplement a parent component named \"app\"\nthat:\n1. Uses the given square component to render all squares from the\n\"colors\" list\n2. Exposes the following\n- which clicking a green square =\u003e change current element\nto \"red\" + add 1 new \"green\" element to the end of list\n- when clicking a red square =\u003e delete current element\n\nvuejs\nwe have 3 garage user have to choose 1 gaurage and each \na has 10 charger\nb has 7 charger\nc has 4 charger\nof them have charger. user request for queue for charger\nand click in the application\nand we have to return on which queue number \n\n\njavascript function \nto we have 3 garage user have to choose 1 gaurage and each \na has 10 charger\nb has 7 charger\nc has 4 charger\nof them have charger. user request for queue for charger\nwrite a logic to select charger\nuser can choose more then 1 garage either\n     A or B \n     B or c\n     A or C\n\n     React with typescript\ncreate parent and child and in child component make input field\nand get value in parent component\n\n\njavascript\ncomapre two array and return first array element that\nare not present in array2\nlet arr1 = [1,2,3,4,5]\nlet arr2 = [0,2,3,4,5]\n\noutput\u003e1\n\nconst Mocha = require('Mocha')\nconst mocha = new Mocha()\nconst except = require('chai').expect\nmocha.suite.emit('pre-require',this,'solution',mocha)\n\n\nfunction countChange(change){\n    return undefined\n}\n\nQuestion javasript\nreturn the value of the changes describe in the object\nwhere the key is the type of coin and the value is the\nnumber of that type of coin\nvalues for each coin in cents:\nPENNY --\u003e 1\nNICKEL --\u003e 5\nDIME --\u003e 10\nQUARTER --\u003e 25\n\ndescribe('change counter',function(){\n    if('sum the change value',function(){\n        const change = {\n            QUARTER:1,\n            DIME:2,\n            NICKEL:3,\n            PENNY:7\n        }\n        expect(countChange(change)).to.equal(0.67)\n    })\n})\n\nlist = 1,2,3,4,5\nprint list[10:]\n\nJavascript\nreturn wether a game has been won based on this player location scores\n** A player wins if they \n* Have no location worth negative points and\n* Hava a total of least 1000 points OR a \nsingle location worth 400 points or more\n** Example ** [300,100,500] -\u003eTrue (400 points \nor more in one location) \n*[300,200,300,350] -\u003eTrue (1000 points \nor more ) \n*[300,200,300,350, -50] -\u003eFalse (location with negative points)\n** @param {number[]} locationScores An integer array\nof this player location scores\n* @ return {boolean} weather or not player has won \n\n\nTake input form use an\ninput = {10,7,4,6,8,10,11}\nthey have common differenc of 2 \nneed to find the longest subarray\n\njavascript\nproblem name is  walking robot\n\nRun the code in the REPL to object\nimplement the walk method this method take in a string,\npath, where each character in the string corresponding to  \na potential movement of the robot. The robot can move \nup,down,left and right represented by the character 'U', 'D', 'L' and 'R'\nAll other character can be ignored . Assume the robot intiail position\n is at (0,0). The output of this method is robot final x and y\n coordinates relative to the inital position\n\n need to pass test case\n it('go 3 times up', function(){\n     var input = 'UUU'\n     var result = walk(input)\n     assert.deepEqual(result,[0,3],'')\n })\n\n given a list of student test scores, find the best avergae grade\n each student may have more than one test score in the list\n\n complete bestAverageGrade function\nif gas one parameter, scores, which is an array of student test scores\neach element in the array is a 2d array of the form [student name, test score]\ntest score may be +ve or -ve integeres\n\nif you end up with an avg grade that is not an integer you should\nuse a floor function to return the largest integere less than or equal to the avg.\nreturn 0 for an empty array\n\nexample \ninput \n[\n    [\"A\",\"87\"],\n    [\"B\",\"100\"],\n    [\"C\",\"64\"],\n    [\"D\",\"22\"]\n\n]\n\noutput is 87\n\ngolang \ninput text = AABAACAADAABAABA\npattern : AABA\n\noutput : pattern found at 0, 9 and 12 index\n\nReact\nimplement a button that can be renedere from a \nconfiguration coming from the server.Assume there\nis already a component that get the configuration\nfrom the server\n\na\u003e color\nb\u003e width and height\nc\u003e text label\nd\u003e onclick action call\n* send Rest Service request with some data\n* change color and label\n* local log\n\ncreate dummy object coming form api\n\nadd functionality to button so that i can drag and drop button \nany where and it shoudl stay there\n\ngolang \nfunc main(){\n    42.toString()\n    int.toString(42)\n    strcov.IToa(42)\n    fmt.Sprintf(\"%v\",42)\n}\n\ngolang\nprint number 100 to 1 in desceinding order\nstart from 0 but still want to print in descending order\nfunc main(){\n    \n   \n}\n\n\ngolang\nfizbuzz\nfor 1 to 100\nmultiple of 3 print fiz\nmultiple of 5 print Buzz\nmultiple of 3 \u0026 5 print fizzBuzz\nfunc main(){\n    \n   \n}\n\n\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n    for i := 1; i \u003c= 100; i++ {\n        if i%3 == 0 \u0026\u0026 i%5 == 0 {\n            fmt.Println(\"FizzBuzz\")\n        } else if i%3 == 0 {\n            fmt.Println(\"Fizz\")\n        } else if i%5 == 0 {\n            fmt.Println(\"Buzz\")\n        } else {\n            fmt.Println(i)\n        }\n    }\n}\n\nthis check is expensive can we minisise the checks\n\n\ngolang\n\ntype RunningAverage struct{\n\n}\n\nfunc main(){\n    ra := RunningAverage{}\n    println(ra.add(1))\n    println(ra.add(2))\n    println(ra.add(3))\n    println(ra.add(78))\n    println(ra.add(11))\n\n}\n\nwrite the add function to add elmenet inside and get avearge\n\n/////////\ngolang\n\ngiven a root of a binary tree and an integer targetsum\nreturn all root-to-leaf paths where the sum of the node values in\nthe path equal target sum. Each path should be returned as a list of the node value\nnot node reference\n\na root to-leaf path is a path starting from the root and ending at any leaf node\nA leaf is a node with no children\n\ninput : root = [5,4,8,11,null,13,4,7,2,null,null,5,1,] target sum = 22\noutput = [[5,4,11,2],[5,8,4,5]]\n\n\nlet say i  have the ability to fetch all music that a given customer\nhas listened to in the past 30 days and how many times they listened to each song\ni'd like to build a playlist containig all the music that people at a party have listened\nto sorted by the number of times each song has been played by the group collectivity\nhow would you store the playlist?\nwhat code would you need to run to get the next song to play?\n\n\ndesign a chat application\nwe can support talk to agent and person to person not group\nagent\nwhat design we can create, data model as well as api call\n\n\nwrite python\nconncet web service authenictate and get data\nwhat module we need\n\nsql query \nid A B C\n1  1 2 3\n2  4 5 6\n3  7 8 9\n3  10 11 12\n4  13 14 15\n4 16 14  15\n\nidentify rows with matching id, valB and ValC\n\ngo object with active as true from array in javascript\n\njavascript combine the array and remove duplicate \nvar employee = [\n    {\n        user:'binary',\n        age:36,\n        active:true\n    },\n    {\n        user:'Fred',\n        age:40,\n        active:false\n    },\n    {\n        user:'pebbles',\n        age:10,\n        active:true\n    }\n]\n\nvar user = [\n    {\n        user:'binary',\n        age:36,\n        active:true\n    },\n    {\n        user:'mike',\n        age:40,\n        active:false\n    },\n    {\n        user:'raplh',\n        age:10,\n        active:true\n    }\n]\n\n\nvar user = [\n    {\n        empid:7616,\n        firstName:'abc'\n        active:true\n    },\n    {\n        user:'mike',\n        age:40,\n        active:false\n    },\n    {\n        user:'raplh',\n        age:10,\n        active:true\n    }\n]\n\n\ngolang\nfunction where read string as input\ni want the dictory as output give count of char in that string\n\n\nnodejs\n\nright rotation\ninput arr[] = {1,2,3,4,5}\nk =2\noutput4,5,1,2,3\n\ngolang\nwrite fizz buzz from 1 to 15\ndivide by 3 i s fizz \ndivide by 5 i s buzz \ndivide by 2 \u0026 5 i s fizzbuzz \n\n\n\ngolang\naccept sequence of whitespace sepearted word as input and\nprint the words after removing all duplicate word and sort them alphanumerically\n\ninput \nhello world and practice makes perfect and hello world\noutput\n\nagain and hello  makes perfect practice world\n\n\ngolang \ncount the frequency of word in a text\n\"go is easy to learn go is fun go is powerful\"\n\ngolang handle panic\n\npackage main\n\nimport \"fmt\"\n\nfunc recoverFromPanic(){\n    if  r:= recover(); r !=  nil{\n        fmt.Println(\"Recoverd from panic:\", r)\n    }\n\n}\n\nfunc doSomething(){\n    panic(\"panic\")\n}\n\nfunc main(){\n    doSomething()\n    fmt.Println(\"Program Conyinue\")\n}\n\npublic class Account{\n    private string id;\n    private string id;\n    private string id;\n    private string id;\n}\n\n\nAEM call external service and need to unique account on basis filter on firstname lastname zipcode\n\ngolang\nwrite a progran that accept a sentense can calculate the number and digitts\n\ninput = \"Hello world! 123\"\noutput\nletter = 10\ndigit = 3\n\n\ngolang \ncalcutae avg score of  a class indivial score are marked\nTOM 90\nTim 85\nKumar 60\nAnjana 98\nKathy 76\n\n\ngolang \n implemnt sumofsquare which take an integer, c and \n return the sum of all squares between 1 and c.\n you will need to use select statements, goroutine and channels\n\n\n enhcance the code with find the difference between\n the square of the sum and sum of square\n\n\n improve if else condition javascript\n return  whether a game has been won based on this player's\n location scores\n\n A play win if they \n have no location worth nrgative point and\n have total of at aleast 1000 point or a single locaion worth 400\n point or more\n\n example [300,100,500] -\u003e true(400 poins or more in on location)\n [300,200,300,350] -\u003e true\n [300,300,300,350,-50] -\u003e false\n\n funtion isGameWon(locationScore){\n     let negativeScore = false;\n     let singleLocation = false;\n     let totalScore = 0\n     for (let i =0;i\u003clocationScores.length;i++){\n         if(locationScores[i] \u003c 0){\n             negativeScore = true\n         }\n         if(locationScores[i] \u003e=400){\n             singleLocation = true\n         }\n\n         totalScore += locationScores[i]\n     }\n\n     if(negativeScore){\n         return false;\n     }else{\n         if(singleLocation){\n             return true\n         }else{\n             if(totalScore \u003e= 1000){\n                 return true;\n             }else{\n                 return false\n             }\n         }\n     }\n }\n\n\n input : [10,7,4,6,8,10,11,12,13,14]\n find out longest subarray in array with common difference\n ouput = [4,6,8,10] and [10,11,12,13]\n\n in react write componrnt that input and return output\n\n golang \n text : AABAACAADAABAABA\n pattern : AABA\n\n output pattern found at 0,9 and 12 index\n\n\n golang \n you have a word in lowercase yourr task is to write thei word\n using fragment  you are given\n Ecach element of fragment can be used more than once\n but they cannot overlap\n it is guaranteed that it is always possible to write\n the word using given fragment\n\n\n what is the min number of element you have to use?\n return 0 if its not possible to build a word\n\n example \n bu + ild + wo + rd  \n BuildWord(\"buildword\", []string{\"buil\",\"dwor\",\"bu\",\"ild\",\"wo\",\"rd\"}) = 4\n\n\n\n angular\n create a button on the page open pop up\n on the pop there will be checkboxes and \n when selecting the check box we click save\n the value of checkbox will be passed to dummy api service \n\n\n\n React logic\n\n when login state is true render user list component into child\n\n React counter program using userreducer with increment and decrement\n\n\n golang lru cache implement\n\n package main\n\n import (\n     \"container/list\"\n     \"fmt\"\n )\n\n type LRUCache struct{\n     maxEntries int\n     cache map[interface{}]*list.Element\n     evicted chan interface{}\n     list *list.List\n }\n\n type entry struct{\n     key interface{}\n     value interface{}\n }\n\n func NewLruCache(size int) *LRUCache{\n     lru := \u0026LRUCache{\n        maxEntries:size\n        cache: make(map[interface{}]*list.Element)\n        evicted: make(chan interface{},1)\n        list: list.New()\n     }\n\n     return lru\n }\n\n\n func (lru *LRUCache) EvictionChannel() \u003c- chan interface{}{\n     return lru.evicted\n }\n\n func(lru *LRUCache) Add(key,value interface{}){\n     if elem, ok := lru.cache[key]; ok{\n         lry.list.MoveToFront(elem)\n         elem.Value.(*entry).value = value\n         return\n     }\n\n     if lru.list.len() \u003e= lru.maxEntries{\n         elem := lru.list.Back()\n         if elem != nil {\n             lru.list.Remove(elem)\n             delete(lru.cache, elem.Value.(*entry).key)\n             select{\n                 case lru.evicated \u003c- elem.Value.(*entry).key\n                 default:\n             }\n         }\n     }\n\n     newEntry := \u0026entry{key,value}\n     ele := lru.list.PushFront(newEntry)\n     lru.cache[key] = ele\n     \n }\n\n func(lru *LRUCache) Get(key interface{}) (interfaceP{,bool){\n     if elem,ok := lru.cache[key];ok{\n         lru.list.MoveToFront(elem)\n         return elem.Value.(*entry).value,true\n     }\n    return nil,false\n}\n\n\n func(lru *LRUCache) Len() int{\n     return lru.list.Len()\n }\n\n\n type User struct{\n     Name string\n     IP string\n     Location string\n }\n\n create a map with name as a key using struct\n\n ///////\n create have component that have text box\n\n on mount we will call the api and get the data.\n and when we type something in text box i will again call api \n and display resut \n\n for api call create custome hook and resume for both call\n\n\n\n ////////\n javascript \n\n let person = {\n     \"name\":\"john\",\n     \"address\":{\"street\":1}\n }\n\n let person1 = person\n\n person1.address.street = \"2\"\n person1.name = \"Amit\"\n console.log(person)\n console.log(person1)\n\n python\n write code i have a word i have not extract first\n letter which is not repeated\n input = 'swiss'\n ouput = 'w'\n\n\n golang\nnumber := [8]int{10,20,30,40,50,60}\nslice from 4 to 8\n\n\ngolang\ni have user struct\n\ntype User struct{\n    Name string\n    IP String\n    Location string\n}\n\ncreate a map for the key is name\n\n\nwrite replace only 3 line code\nMain(){\n    x := 5\n    replace(\u0026x,10)\n    fmt.Println(x)\n}\n\nList = [1,1,'j',true]\nMutuable (can be changed)\nAllow duplicate\n\ntuple = (1,2,3,'dd',5)\nImmutable(cannot be changed)\n\n\ndictionaries\n{\n    \"name\":\"john\",\n    \"age\":10\n}\nMutuable\nkey must be unique\n\nsets\n{1,2,3}\n\u003e Mutuable\n\u003e No Duplicate value\n\n\ngolang\nsimiluate race condition example code\n\n\ngolang\npackage main\nimport \"fmt\"\n\nfunc main(){\n   isSapce := func(ch byte)bool{\n       switch(ch){\n        case ' ' : //errro\n        case '\\t':\n        return true\n       }\n       return false\n       \n   }\n\n\n   fmt.Println(isSpace('\\t'))\n   fmt.Println(isSpace(' '))\n}\n\n\nimport (\n    \"fmt\"\n    \"time\"\n)\n\nfunc main{\n    data  :=  []string{\"one\",\"two\",\"three\"}\n\n    for _,v  := range data{\n        go func(){\n            fmt.Println(v)\n        }()\n    }\n\n    time.sleep(3* time.second)\n}\n\n\ngolang\n[]string[\"flower\",\"flow\",\"flight\"]\n\noutput:\"fl\"\n\nfind larget prefix\n\n\ngolang \nsimple code how to go rotuine work\n\ngolang write function \n    there is imteral api call and get the Response\n    Make http request if respons is good display else add error handling\n\n\ngolang code to connect to database\njust check if connection is succesful return nothing\n    else error\n\ngolang function read json file and print filed nam and id\n\n\nReact \ncreate 2 component  address search\nparent and child\n\nwhen we type address give suggestion for address\nselect approprite address and console.log\ntake dummy data\n\n\ngolang \nwe define a simple \"Greeter\"\nservice with \"Sayhello\"method\nthat take a \"hellorequest\"message\ncontaining a name of return \na \"HelloRequest\" message write a greeet mesaage\n\nservice Greeter{}\n\n\n(function(){\n    var a = b = 3\n})();\n\nconsole.log(\"a defined? \"+(typeof a!== 'undefined'))\nconsole.log(\"b defined? \"+(typeof b!== 'undefined'))\n\n\nwith simple html and javascript without css like enter pin \nwe need to hide input char as soon user type after 3 sec\nwhen type next char all previous must be hidden\n\n\n\nReact\ncreat a responisve layout of 3 column with flex box\n\njavascript\n\nconst trans = [{\n    \"category\":\"sports\",\n    \"amount\":50\n},\n{\n    \"category\":\"sports\",\n    \"amount\":100\n},\n{\n    \"category\":\"sports\",\n    \"amount\":-20\n},\n{\n    \"category\":\"travel\",\n    \"amount\":100\n},\n{\n    \"category\":\"dinning\",\n    \"amount\":150\n},\n{\n    \"category\":\"travel\",\n    \"amount\":120\n}]\n\nwrite one code which will return output like its is retrun highest amount from particular category\n[\n    {\"sports\":100},\n    {\"travel\":120},\n    {\"dinning\":150}\n]\n\nflat this array with one loop only\nconst arr1 = [1,2,3,4,[5,6,[7,8]],[9,10]]\n\nfunction should take index of nested array \nadd try catch also and optimised to use one loop\nwe can pass varaible like example pass 1\noutput should be\n\ninput 1 \u003e 1\noutput \u003e [1,2,3,4,5,6,7,8,[9,10]]\n\ninput 1 \u003e 2\noutput \u003e [1,2,3,4,[5,6,[7,8]],9,10]\n\n\nReact\nuseEffect()\nuseEffect(fn,[dep])\n\n\nyou are given an integer 'num' you can swap two digit at most once \nto get the max values number\nretur  the max valueed number you can Get\n\nexample 1\ninput \u003e 2736\noutput \u003e 7236\n\n\nexample 2\ninput \u003e 9973\noutput \u003e 9973\n\nexample 3\ninput \u003e 1993\noutput \u003e 9913\n\n//////\n\npython\ntake 2 diff size of unsorted array containing \nduplicate elements then merge the array without duplication\n    in a sorted manner\n\npython \ncode to check if two strings are anagram of each other?\nlisten-silent\nhear-hire\nbored-robed\n\n\nreact\nthis.setState({\n    counter:this.state.counte+this.props.incremtn\n})\n\n\nconst obj1 = {a:1,b:{c:2,d:3}}\nconst obj2 = {b:{c:4,e:5},f:6}\n\njavascript\nwrite function take array of integrager and return \nmost frequent value in array \n\n\n\nconst numbers = ['10','10','10'].map(parseInt)\n\n\nconst fn = () =\u003e  console.log(this)\n\nconst fn1 = fn.bind({something:true})\n\n.net \nyou have tasked with migrating a substatial VB 6.0 application to VB .net how would you approch this migration to  ensure minimal disruption and maintain functionality\n\njavascript\nPromise.reject()\n    .then(\n        () =\u003e  console.log(0),\n        () =\u003e  console.log(1)\n    )\n    .finally(() =\u003e console.log(2))\n    .catch(() =\u003e console.log(3))\n    .then(() =\u003e console.log(4))\n\n\n\nfunction run(){\n    console.log('Script start')\n\n    setTimeout(function(){\n        console.log('settimeout 1')\n    },1)\n\n    setTimeout(function(){\n        console.log('settimeout 0')\n    },0)\n\n    \n}\n\n\njavascript\nvar a = 1\nfunction b(){\n    a = 10\n    return;\n    function a(){\n\n    }\n}\nb()\n\nconsole.log(a)\n\n\n\nfor(var i = 1;i\u003c=5;i++){\n    setTimeout(function(){console.log(i)},1000)\n}\n\n\nhtml and csss\nhave 4 box and align them on all 4 corner with flex in css\n\njavascript\na = 10\nconsole.log(a)\nvar a\n\n\nfunction x(){\n    for(var i=0;i\u003c5;i++){\n        setTimeout(function(){\n            console.log(i)\n        },1000)\n    }\n\n    console.log('123')\n}\n\nx()\n\n\nReact\nfetch todo items from the given api\nrender the todo items on the page\nupdate the server when a todo item is checked or unchecked\n\n\napi document\nhttps://jsonplaceholder.typicode.com\n\n[GET]/todos?userId=1\nretrive all todo items for user 1\n\n[patch]/todos/\u003ctodoid\u003e\nupdate the todo item with the given id\n\n\nhtml css\nwe have outer and inner div we need to design css for both\nwe need to have inner box smaller and placed in center of outer large box\n\nwe have 2 indepent component and need to share data from component 1 to compoent 2 using redux flow\n\n\nnodejs\ni have list of book in sql and you want a route for insert and update data\n\n\nwe have 1 node project and 4 database how can i make 4 db connection with app\n\nneed sql query\nemp_master \u003e emp_id, emp_name, manager_id\nfetch hierarchy of manager both in upward and doward direaction based on empid\n\nE1\u003eM1\u003eM2\u003eM3\u003eM4\u003e CEO(upward)\nE1\u003cF1\u003cF2\u003c(downward)\n\njava\n\u003e hiberante arch and how jpa help us in lazy loading\n\u003e implement the redis cache in springboot\n\u003e oauth in spring boot\n\u003e how to take care cache thread pool\n\u003e java if we have parallel stream explain machenism\njava compiliable future work in\n\n\nangular\ncreate custome direactive to move mouse in downarad direaction\n\n\ncreate post  /maxProfit to find the max profit that can be obtained by buying and selling a\nsingle share of a given stock multiple times.\nthe endpoint should access a json body with an array of n integre represent the price of the stock on n\nconsecutive daya\n\noutput json should\n\nmaxprofit: an integer the mac profit that can be obtained bt buying and selling\ntransction: tuple represent the by ans sell in the day\n\nex\ninput {\n    \"price\":[7,1,5,3,6,4]\n}\n\nResponse\n{\n    \"maxProfit\":7,\n    \"transcition\":[\n        {\n            \"buy\":1,\n            \"sell\":5\n        },\n        {\n            \"buy\"3,\n            \"sell\":6\n        }\n    ]\n}\n\n\n\n\npython\nuse pytest to write unit test\n\nimport aiohttp\n\nasync def fetch_user_data(user_id):\n    url = f\"http:/testurl/{user_id}\"\n    async withaiohttp.ClientSession() as session:\n        async with session.get(url) as response:\n         response.rasie_for_status()\n         return await response.json()\n\ndef fetch_user_posts(user_id):\n    return [{\"id\":1,\"title\":\"Post 1\"},{\"id\":2,\"title\":\"Post 2\"}]\n\ndef get_user_with_post(user_id):\n    user_data = fetch_user_data(user_id)\n    user_posts = fetch_user_posts(use_id)\n    return{\n        'user':user_data,\n        'posts':user_data\n    }\n\n\ngolang\ncreate function name reverseString\ninout \u003e \"hello\"\noutput\u003e \"olleh\"\n\ngolang\nwrite function to check if a number is prime \n\ninput \u003e isPrime(2)\noutput \u003e true\n\ninput \u003e isPrime(4)\noutput \u003e false\n\ngolang\npartitioning into min number of deci-binary numbers\n\nA decimal number is called deci-binray of each of its digit is either 0 or 1 \nwithout any leading zero. example 101 and 1100 are deci-binary and 112 and 3001 is not\n\nexample1\ninput n = \"32\"\noutput = 3\nexplaination 10+11+11 = 32\n\n\nexample2\ninput n = \"82734\"\noutput = 8\n\ngolang\n\n\n\n[0 0 1 0\n0 1 0 0\n0 0 0 1\n0 1 0 0]\n\ngenerate 4*4 output sould be 1'once\n\n\ngolang\nif we have input  as array of string we need to find the value is palindrome or not\n\ninput = [\"kayak\",\"deter\",\"Abba\",\"make\",\"deified\"]\noutput = [['kayak','Abba','deified'],['deter','make']]\n\n\njavascript\nimplement a function for dashify\ninput \u003e hello\noutput\u003e h-e-l-l-o\n\n\njavascript \nremove duplicate from the array\ninput = [2,1,2,3,1,2,3]\noutput = [1,2,3]\n\nReact\ncreate a todo list in ui without any functionality\nuse data \n\nconst data = [\n    {\n        id:1,\n        text:'Docoto call',\n        completed:true\n    },\n    {\n        id:2,\n        text:'Metthing call',\n        completed:false\n    },\n    {\n        id:3,\n        text:'Scoor call',\n        completed:false\n    }\n]\n\n\njavascript\n\nlet x = {}\nx.forEach((y) =\u003e {console.log(y)})\n\n\npython\ngiven a partically filled 9*9 2d 'array grid[9][9]  the goal is to assign digit to the empty cell\nso that every row,column and subgrid of size 3*3 contains exactky one instance of the digit fron 1 to 9\n\ngoal is to create a fun will retur the sudoko filed out in 2D arrat\n\n\njavascript\nsample bank app like creat account and get user account details\nif account id already ther then should say id already takem\n\ngolang\nimplement a simple linklist\n\n\nReact \nin social media we have like and disalike\nwe want counter value to increment and dectrmenent\n\n\nReact\ncreate 2 input \none static currency as US\nand in second one user can enter and on basic of that it should conver\n\n\n//html css\n// you have 4 divs align then in one line with eqaul space between using flex box\n\n\n//javascript\n\n// given a linked list swap every two adjcent nodes and return\n// its head.\n// you may not modify the value in the list nodes, only nodes itself may be changes\n\n\n\n//javascript do not use inbuilt\nrevert the string\ninput  \u003e uoy-era-woh\noutput\u003e How are you\n\n\n//javascript\nwrite function getTotal which will return sum of all argment\ngetTotal(2,3,4,5)(4,5,6)\n\n\npython\n\nwrite function fill_shape  to fill coloer\nwhere parameter type of canvas is (canvas: List[List[int]],x;int,y:int)\nsimilar to ms paint(fill the canavs from the point clicke up until the closet boundries)\nwhite pixels are reoresented with 0, \nblack pixels are reoresented with 1,\nthe coolor are represented by 2\n\n\npython\nlist of integere and find the number apperining most\n\npython \ndesign a class to calculate area of shape \nit can square, rect or circle\n\nJavascript \nthe code recusive code will cause a stack overflow of the array list is too large\nhow can you fix this still retain the recusive pattern\n\nvar list = readHugeList()\nvar nextListItem = function(){\n    var item = list.pop()\n    if(item){\n        //process the list\n        nextListItem()\n    }\n}\n\n\n\n\nHTML \n\u003e\u003e What is the novalidate attribute used for in HTML forms\n\u003e\u003e Regex to accept only numbers \n^\\d+$\n\u003e\u003e How can you enhance the accessibility of application \n\u003e\u003e Difference in async and defer attributes are used in the \u003cscript\u003e tag.\nasync: Downloads the script asynchronously and executes it as soon as it is ready, without blocking the HTML parsing.\ndefer: Downloads the script asynchronously but defers execution until after the HTML parsing is complete.\n\u003e\u003e Block VS Inline \n\u003e\u003e How we can allow user to open default mail \n\u003ca href=\"mailto:example@example.com\"\u003eSend Email\u003c/a\u003e\n\u003e\u003e \n\n\n\nCSS \n\u003e\u003e in which case we should use translate insted of absolute positing in css\n\u003e\u003e How to make div in center \n.centered {\n    margin-left: auto;\n    margin-right: auto;\n    width: 50%; /* or any width */\n  }\n\u003e\u003e z-index property and how does it work\n\u003e\u003e how to adjust height of one div with respect to other \n\u003e\u003e Change sequence of div in CSS \n.box1 {\n    order: 3;\n  }\n  \n  .box2 {\n    order: 1;\n  }\n  \n  .box3 {\n    order: 2;\n  }\n\u003e\u003e How do you combine multiple media query conditions?\n\u003e\u003e Purpose of  and, not,   and or not in Media querry\n\u003e\u003e Breakpoints in media query\n\u003e\u003e Flex Container with Equal-Width Children\n.container {\n    display: flex;\n}\n.item {\n    flex: 1; /* Equal width for all items */\n    padding: 10px;\n    background-color: lightcoral;\n}\n\u003e\u003e Reorder Flex Items\n\u003e\u003e CSS to add background to even rows in list \nli:nth-child(even) {\n    background-color: #f0f0f0;\n}\n------------------------\njavascript\n\nArray Destructuring:\nconst arr = [1, 2, 3];\nconst [a, b, c] = arr;\nconsole.log(a, b, c); // Output: 1 2 3\n\nObject Destructuring:\nconst obj = { x: 1, y: 2 };\nconst { x, y } = obj;\nconsole.log(x, y); // Output: 1 2\n\nOutput of \nconst nested = { a: [1, 2], b: { c: 3 } };\nconst { a: [x, y], b: { c } } = nested;\n     // Output: 1 2 3\n\n\n\nreturn the string\ninput  \u003e uoy-era-woh\noutput\u003e How are you\n\njavascript\nwrite function getTotal which will return sum of all argment\n    getTotal(2,3,4,5)(4,5,6)\n\n\njavascript\n    comapre two array and return first array element that\n    are not present in array2\n    let arr1 = [1,2,3,4,5]\n    let arr2 = [0,2,3,4,5]\n\n\u003e\u003e    Find the Largest Number in an Array\nfunction findLargestNumber(arr) {\n    return Math.max(...arr);\n  }\n\u003e\u003e How we make sure if the function is called after set amount of time \n    function debounce(func, wait) {\n        let timeout;\n        return function(...args) {\n          clearTimeout(timeout);\n          timeout = setTimeout(() =\u003e func.apply(this, args), wait);\n        };\n      }\n      \n      const log = () =\u003e console.log('Debounced!');\n      const debouncedLog = debounce(log, 2000);\n      debouncedLog(); // Function will be \n\n\u003e\u003e debounce in javascript\n\nmap\nfilter\nspread\nlet vs var vs const\n--------------------\nNode\nDiff between put vs patch\nDifferen http status code\nwhat is middleware and which middleware we use fo post call\nHow jwt work\ndiff between first and refresh token\n\u003e\u003e difference between require and import in Node.js?\n(coding)\ni have list of book in sql/mongo and you want a route for insert and update data\n\n-----------\nHow to create custome pipe\nwhat to restrict user to user certain page in app\nWhat are the subjects in angular\nUse of mergeMap and concatMap \n\u003e\u003eare higher-order mapping operators that transform Observables, but they handle the emissions of inner Observables differently:\n\n\u003e\u003e What are some common RxJS operators?\nmap: Transforms emitted values.\nfilter: Filters emitted values based on a condition.\nmergeMap / flatMap: Projects each value to an Observable and merges the results.\nconcatMap: Projects each value to an Observable and concatenates the results.\nswitchMap: Projects each value to an Observable and switches to the latest one.\ndebounceTime: Emits a value from the source Observable only after a specified delay.\ndistinctUntilChanged: Emits only distinct values based on a comparison function.\ntake: Emits only the first N values from the source Observable.\n\n\u003e\u003e Purpose of combineLatest work?\n\u003e\u003e How can you handle errors in RxJS?\n\u003e\u003e Different type of subjects \n(coding)\nhttps://jsonplaceholder.typicode.com/posts\ncall api in angular service using observable\n\n\u003e\u003e How can we create custom themes in angular \n\u003e\u003e Purpose of snacbar in angular material\n\nES6  \n\u003e\u003eHow generator function works\n\u003e\u003e Promise.all and Promise.race\n\nSpringBoot \nHow does Spring Boot handle dependency injection?\nExplain the role of Spring Security in a Spring Boot application and \nhow to configure basic authentication, JWT-based authentication, or OAuth2.\nDiscuss how Spring Boot supports databases with Spring Data JPA, Hibernate, and auto-configuration for different data sources.\nExplain how to use @Scheduled annotations to schedule tasks in Spring Boot \nHow to optimize the performance of a Spring Boot application?\nlazy loading, proper caching mechanisms (e.g., @Cacheable), connection pooling, and profiling.\nExplain how to design microservices using Spring Boot, \nincluding service registration and discovery with Eureka, API \nGateway with Zuul or Spring Cloud Gateway, \nand inter-service communication using Feign.\nWhat is the difference between @RequestMapping and @GetMapping or @PostMapping?\nHow does Spring Boot integrate with message brokers like Kafka or RabbitMQ?\nExplain how Spring Boot can connect to message brokers, \nset up listeners, and handle asynchronous communication with messaging systems like Kafka or RabbitMQ.\nHow would you implement a custom filter or interceptor in Spring Boot?\nFilter interface or interceptors using HandlerInterceptor and configure them in the Spring Boot application.\n\nJava 8\n\u003e\u003eWhat is the difference between map() and flatMap() in Java 8 Streams?\n\u003e\u003e How can we implement map() and flatMap()\nList\u003cString\u003e words = Arrays.asList(\"hello\", \"world\");\nList\u003cInteger\u003e wordLengths = words.stream()\n                                 .map(String::length)\n                                 .collect(Collectors.toList());\n map() transforms each element of the stream, whereas \nflatMap() is used when the transformation results in a stream of elements (i.e., flattening a stream of streams into a single stream). \n\u003e\u003e How can you make a class immutable in Java?\nUse final for the class and its fields, ensure fields are initialized only once (in the constructor), and do not provide setters.\n     Additionally, return deep copies of mutable objects when necessary.\n\u003e\u003eHow do you convert a List to a Stream in Java 8?\nFor example, List\u003cString\u003e list = Arrays.asList(\"a\", \"b\", \"c\"); list.stream().\n\u003e\u003e What is the @FunctionalInterface annotation used for?\nit has exactly one abstract method and can be used with lambda expressions.\n\u003e\u003e How can we imporve the efficiency of stream\nLazy Evaluation: Intermediate operations (like map or filter) are not executed until a terminal operation (like collect or forEach) is called.\nParallel Streams: Stream operations can be easily run in parallel with the parallelStream() method, improving performance for large datasets.\n\n\u003e\u003e Steps to integrate oAuth in Java\n\n\nmicroservice\n\u003e\u003e How we manage communication between microservices?\nSynchronous Communication: Typically achieved using REST, gRPC, or GraphQL for real-time data exchange.\nAsynchronous Communication: Message brokers like Kafka, RabbitMQ, or ActiveMQ are used for event-driven architecture, where services communicate using events and messages.\nService Mesh: Tools like Istio or Linkerd help manage service-to-service communication by providing traffic routing, load balancing, and retries.\nAPI Gateway: A gateway acts as a single entry point for client requests and routes them to the appropriate services.\n\u003e\u003e. What are the common strategies for inter-service communication in microservices?\nDirect Communication:\nREST: Typically used for synchronous HTTP-based communication.\ngRPC: A high-performance RPC framework that uses protocol buffers for data serialization and supports synchronous communication with better performance.\nMessage Brokers:\nAsynchronous Communication: Kafka, RabbitMQ, or ActiveMQ are used to enable services to communicate asynchronously by sending messages to a broker.\nEvent-Driven Architecture: Microservices publish events to an event bus or a message broker, and other services subscribe to these events.\nService Mesh: Service meshes like Istio or Linkerd provide advanced communication capabilities such as traffic routing, observability, and fault tolerance without changing the application code.\n\nSQL :\n\u003e\u003e write a query to find the second highest salary in a table?\nSELECT salary FROM Employees\nORDER BY salary DESC\nLIMIT 1 OFFSET 1;\n\u003e\u003e Delete duplicate rows while keeping the one with the lowest id\nWITH CTE AS (\n    SELECT *, ROW_NUMBER() OVER (PARTITION BY column1, column2 ORDER BY id) AS rn\n    FROM my_table\n)\nDELETE FROM my_table\nWHERE id IN (SELECT id FROM CTE WHERE rn \u003e 1);\n\u003e\u003e Find employees whose salary is above the average salary in their department:\nSELECT employee_id, salary \nFROM Employees e\nWHERE salary \u003e (SELECT AVG(salary) \n                FROM Employees \n                WHERE department_id = e.department_id);\n\npython\ndef abc(x):\n    x = 10\n\ny = 5\nabc(y)\nprint(f\"y = {y}\")\n\n\n\ndef abc(x):\n    x += [10]\n\ny = [5]\nabc(y)\nprint(f\"y = {y}\")\n\ndef abc(x):\n    x = [10]\n\ny = [5]\nabc(y)\nprint(f\"y = {y}\")\n\n\n\ndef abc(max):\n      count = 1\n      while count \u003c= max:\n        yield count\n        count += 1\n        \nout = abc(5)\nprint(next(out))\nprint(next(out))\nprint(list(out))\n\n\na = [[1,2,3],[4,5,6],[7,8,9]]\nout = [[row[i] for row in a] for i in range(len(a[0]))] \nprint(out)\n\n\nyou are given an array customers where customers[i] = [arrrival,time]\narrival \u003e is the time of the customer. The arrival times are sorted in non-decreasing order.\ntime \u003e is the time needed to prepare the order of the ith customer\n\nwhen a customer arrives he give the chef his order and the chef start preparing it once he is idle\nthe customer wait till the chef finesh preparing the oder\nthe ched does not prepare food for more than one xustomer at a time\nthe chef prepare food foe the custome rin order they input\n\nretunr the avergae wiaiting time of all customer solution with 10^-5 from the actual answer are\nconsidered acceptrd\n\nex1\ninput [[5,2],[5,4],[10,3],[20,1]]\noutput\u003e 3.25000\n\nex2\ninput [[1,2],[2,5],[4,3]]\noutput\u003e 5.0000\n\n\n\nJavascript\nvar a = (function(x){\n    delete x;\n    return x;\n}(0))\n\nconsole.log(a)\n\n//output\u003e 0\n\n\n\n/////\nCaching\n\n\u003e What is the use of in-memory caching in application\n\u003e Implement a simple logic with nodejs+mongodb+redis for get api\n\u003e difference between in-memory and distributed caching \n\u003e\u003e How does Redis handle persistence?\n\u003e\u003e How to monitor and manage Redis performance\n\u003e\u003e How does Memcached handle data expiration and eviction?\nExplain the two main persistence mechanisms: \nRDB (Redis Database Backup) and AOF (Append-Only File), and their trade-offs.\n\ngraphql\n\u003e What is GraphQL, and how does it differ from REST?\n\u003e What is a GraphQL query, and how does it differ from a mutation?\n\u003e Can you explain the concept of \"schema stitching\" in GraphQL?\n\u003e\u003e Role of introspection in GraphQL\n\u003e Given a GraphQL query, write the resolver function for fetching data from a database.\n\u003e Implement a pagination solution for a list of items using cursor-based pagination in GraphQL.\n\u003e How do you handle file uploads in GraphQL?\n\u003e How do you implement caching in a GraphQL server?\n\n\nJenkins\n\u003e how are you using jenkins in your app and what are the different stages you have\n\u003e Can you write simple jenkins file with pull, build and deploy stages\n\nMySql\n\u003e Create a query in MySql for student and marks table  to find top five student on basis of marks\nwhere both table have releation ship of rollNo\n( if done above)\n\u003e Please save above output in view\n\u003e Write a SQL command to update data through a view and handle any potential issues with view updates.\n\u003e\u003e Provide the SQL command for updating data and discuss any limitations or requirements.\n\u003e\u003e What is a materialized view, and how does it differ from a regular view?\n\n\nServerless Architecture\n\u003e What id a usecase of lambda in your application\n\u003e what are the limitation on lambda\n\u003e How you are exposing lambda function\n    Ans \u003e Api gateway\n\u003e What are the common triggers for serverless functions?\n\u003e How do you handle authentication and authorization in a serverless environment?\n    xplain methods such as API Gateway authorizers, OAuth, JWT tokens, and integrations with identity providers.\n\u003e How do you handle versioning and rollback in serverless functions?\n     such as using AWS Lambda versions and aliases, \n     strategies for rolling back to previous versions if needed.\n\n\nMongoDB\n\u003e How does mongodb scale the database \nans \u003e horizonatly\n\u003e What is the concept of sharding\n\u003e What happen if we have even number of Replica in election when one Replica down\nans \u003e add arbitrary node\n\u003e How do you insert a document into a MongoDB collection?\n\u003e How do you perform aggregation in MongoDB?\n    Discuss using the aggregate method and \n    common stages like $match, $group, $sort, and $project:\n\u003e How do you perform text search in MongoDB?\n    db.myCollection.createIndex({ description: 'text' });\n   db.myCollection.find({ $text: { $search: 'keyword' } });\n\u003e best practices for managing MongoDB performance and reliability?\n     monitoring with tools such as MongoDB Atlas, \n     sharding for large datasets, \n     indexing for query optimization\n     backups for data recovery.\n\n\nReact \u003e\u003e\n\u003e\u003e manage state in a React application\nLocal Component State: Using useState or this.state in class components.\nContext API: For global state management.\nState Management Libraries: Such as Redux or Zustand for more complex state nee\n\u003e\u003e How do you optimize performance in React applications?\n    Memoization: Using React.memo and useMemo to prevent unnecessary re-renders.\nCode Splitting: Lazy loading components with React.lazy and Suspense.\nAvoiding Inline Functions: Creating functions outside of render methods to prevent re-creation on each render.\nVirtualization: Using libraries like react-window or react-virtualized for rendering large lists efficiently.\n\n\ngolang\nstep1\n4,7,12,19,28,.......200\n(generate this screen in golang)\n\nstep2\ngenerate square for odd number\n\nstep3\nadd the square to the mat and calculate the total area occuiped\n\nall three step should have parallel and in finally \n\n\npackage main\n\ntype ( \n    Shape interface {\n    getArea() float64\n    }\n\n    Square struct{\n        side float64\n    }\n\n    Mat struct{\n        shapes []Shape\n    }\n\n    tPlaceCh chan Shape\n\n\n)\n\nfunc (s *Square) getArea() float64{\n    return s.side * s.side\n}\n\nfunc (m  *Mat) getAreaOccupied() (result float64){\n    for _, shape := range m.shapes{\n        result += shape.getArea()\n    }\n    return\n}\n\nfunc (m *Mat) place(shape Shape){\n    m.shapes = append(m.shapes, shape)\n}\n\n\nnodejs\nconst qs = require('querystring').parse('foo=bar\u0026abc=xyz\u0026abc=123')\n\nhow can we access value 123\n\noption \n1) qs['abc']['abc']\n2) qs[0]['abc']\n3) qs['abc'][1]\n4) qs['abc']  \u003e correct\n\nmongodb\nwhat is the principle implication of using bulk write operation in MongoDb\n1) decreasing performance\n2) Increased throughput  \u003e\u003e correct\n3) Increased data quality\n4) increases network traffic\n\nnodejs execute event loop starting from newwst first\n\nmicroservice nodejs\nwhat happen to deployed microservice when you use the 'service instance per container' deployment pattern\n\n1) they become isolated\n2) they share resource\n3) they become difficult to scale up or down\n4) they are inrestricted in terms of cpu/memory consumption\n\nnodejs\nwhich npm command prints all local packages that need updating\nans \u003e npm outdated\n\nnodejs\nhow can you modify node's global module search path\nans\u003e set NODE_PATH=C:\\path\\to\\your\\global\\modules\n\nJavascript\nsimilar strings\ntwo strings are said to be similiar if they are composed of the same character\nexample \"abaca\" and \"cba\" are similiar since both of them composed of character \n'a','b','c'\nbut 'abaca' and 'bcd' are not similiar\n\ngiven an array of string words of length n, find the number of pairs of string that are \nsimiliar\n\nexample\nn =3 , words=['xyz','foo','of']\nanswer = 1\n\ncreate function countSimilarPairs(word){\n\n}\n\n\ngolang\nimplement function to merge two sorted link list as\nnew sorted linklist\n\n\ngolang\nwe need to refeactor large if statement\nusing polyomormisum\n\n\ngolang\nwe need to start http server and define handler and respond with myname\n\n\ngolang\nwe need to print number from 1 to 10\none go routine will print odd and one even\nand print output in correct order\n\ngoalng\ngiven three array soretd in non-decreasing order\nprint all comman element in these array\n\ninput \narr1[]= {1,5,10,20,40,80}\narr2[] = {6,7,20,80,100}\narr3[] = {3,4,15,20,70,80,120}\noutput = 20 ,80\n\npython \n\nReact\nCretae todoList user able to add edit and complete and\n\nReact\nthe application has 2 component\nfile \u003e contains input box and filelist component\nfillist \u003e display the list of files and filders an let user add \nmore files\n\nintial Data:\n{\n    name:src,\n    isOpen:true,\n    files:[\n        {\n            \"name\":\"App.js\"\n        },\n        {\n            name:\"component\",\n            \"isOpen\":false,\n            \"files\":[{name:\"File.js\"}]\n        }\n    ]\n}\n\nrequirent\n1) inital component should display file folder structure\naccorsing to the given intial data\n\n2) there should be + button at the end of every folder\n3) clicking a folder shoudl toggle its expansion and chnage the + sign to - sign\non expansion and vice versa\n4) clicking a file should do nothing if it does not contain file or a folder\n5) Double -clicking a files should make it a folder\n6)clicking + button \na) should take afile name from the input box, add it to the require folder and reset\nthe input box\nb) shoudl if thr input box is empty display an alert saying \" Please enter file name\"\n\n\nNote: Each item in the list is \u003cli\u003e tag with two items \u003cbutton\u003e which conatin a \u003cspan\u003e\nfor display + and - and a \u003cul\u003e for displaying its sub file/folder if any\n\n\nJavaScript\nfunction test(){\n    var a = 'a'\n    (function(){\n        console.log(a)\n        return;\n        var a = 'b'\n    })()\n}\n\n{\n    company:'HCL',\n    address:\"Noida\",\n    \"techno\":{\n        \"ui\":\"opo\",\n        \"java\":\"asd\",\n        \"subtechno\":{\n            html:\"abc\",\n            css:\"frv\"\n        }\n    }\n}\n\noutput{\n    company:'HCL',\n    address:\"Noida\",\n    \"techno_ui\":\"opo\",\n    \"techno_java\":\"asd\"\n    \"techno_subtechno_html\":\"abc\",\n    \"techno_subtechno_css\":\"frv\"\n}\n\n\ngolang\nping pong app with go routine and gochannel\n\ngolang we have connection pool for db clinet\nonce we get request we fetch client from pool fetch and response\ndesign code for this create dummy client\nintilize quantity and max quantiy\nif no client available go to max and if go max close\n\n\narray return most repeated item in an array\nconst nested = [2,'A',2,['A',4,['A',6,['A',8]]]]\n\n\nReact\nA list of clor composed of red and green elements\nA \"square\" component that render a square of a given clor and \nexecute a click method\n\nimplenment a parent component named \"App\"  that:\n1. Uses the give square component  to render all square from the \"color\" list\n2. Expose the following functionallity\na\u003e Click green =\u003e change current element to \"red\" + add 1 \"new \"green\"\nelement at the end of the list\nb\u003e click red \u003e delete current elemement\n\nreact\nreact component implemnt counyer\n\ngolang\nimplement a procedure and consure using gochannle \nproducer should generate sires of integr and consumner should\nrecive from channel and double the integer and return and\nshut down the system gracefully\n\npython \nwrite function that recive 2 interga return true f those are equal\nelse false\n\nlist at least 5 non-trivial test case they have to be postivr and negative\n\npython \nwrite a script that gets a urls as argument\nmakes a ping to the host and append the result to a file\n\n\njavascript\nwe have array of object on basis of index user provide\nwe need to pick value without iteration\n\n\njavascript\nuse Destructuring\nwe have key value pair \ntry to retrive data from a map structure from a particular index\n\n\nwe have endpoint\nwrite react component and list down the title on order list\nhttps://jsonplaceholder.typicode.com/posts?_limit=10\n\ngolang \n \nhttps://gist.githubusercontent.com/pyPRO2019/dc44ae45f7cfe2f2a34fec30db4678eb/raw/df247df4e11260c669f986d0de589a90459d7e7b/students_data.csv\nread data nd find uniqure recored\n\nyou are workinh on an edu game platform where iser can access and play edu game to \nlearn various subject. \n\nReq\n1)user should have profile with the basic info like usernmae and email\n2)game have various ataribute including title, subject and dicciculty level\n3) user can play multiple games and their progres should be tracked for each game\nseparatley\n4) the progress should include info like score achieved and the data of the last playthourgh\n5) user should earn achievment in games based on their in-game actions and perfomance . the \nachievemnt info includes the achcievemnt name in addition to the date\n\nTask1\ndesign a complerhsive database schema to represent these entires\n(user game, progress and achievment) and establish the necesasry relation\nbetween them\n\ntask2 sql query\nthe edu game platforn has gained popularity ans there is a need to \nshowcase the top- performing\nuser in each subject based on their overal achievment\n\nthe challenge is ti retireve a list of user who have achieved the highest total score in \neach subject create a query that return a list containing rhe top-performaing\nuser in each subject for each subject includes user basic info(usernmae, email)\nand total score achieved\n\n\n\ntask3\ny\npagination bug fix:\nonserve that there is a bug in pagination where despoite having 16 items \nin the list only3 pages are displayed (assume 5 per page) identify and retify\nthe bug to ensure that the pagination display the correct number of pages\n\nfunction cretapAgination(){\n    const totalpage = Math.floor(subjectData.length/itemsPerPage)\n    const paginationContainer = docuemnt.getElementById('pagination')\n    paginationContainer.innerJTML = ''\n\n    for(let i = 1; i\u003c=totalpages;i++){\n        const pageLink = document.createElement('li')\n        pageLink.classList.add('page-item')\n        pageLink.innerHtml = '\u003ca class=\"page-link\" href=\"#\"\u003e${i}\u003ca/\u003e'\n\n        pageLink.addEventLisetner('click',()=\u003e{\n            displaySubjects(i)\n            window.scrollTo(0,0)\n        })\n        paginationContainer.appendChild(pageLink)\n\n    }\n}\n\n \njavascript \ncreate pareant and child component \nand share data between them using context api\n\nreact\ntest case for counter finction\n\nvue3\n'use strict'\nconsole.log(b)\nvar b = 10\n\nfor(var i = 0;i \u003c5;i++){\n    setTimeout(() =\u003e {\n        console.log(i)\n    },1000)\n}\n\nreact\n\njavascript \ndebounce\n\n\njavascript \npalindrome code\n\ngive a json aaray of onkevt return all object that have key\nvalue that matches  a condition\n1. build an executable that excetur this list and return all object whose \nbirthdate contains 1990\n2. if necessary extend method to \nreturn all objects who meets additional criterta favorite color = blue\nconst data = [{\n    name:'Anne',\n    birthdate:'01/01/1990',\n    favcolor:'blue'\n}\n]\n\ncss\nwhat is height of element have content 10px border 1px padding 5px and margin 10px\n\njavascript\nwrite code which handle this senario\n1\u003e sum(1,2,3,.....n)\n\n2\u003esum(1)(2)(3)......(n)\n\nreact \nmake react component\ncall api with async and await\njsonsplaceholder.typicode.com/users\n\nreact native\n\u003e how to implment custome animation for user interface transition react native\n\u003e to handle third party with react native\n\u003e react-native how can we ensure react native app is aceesibiliy to disable perosn\n\u003e react-native how to configure to access local db like SQL lite for offline data\n\u003e react-native major the perforamce of app\n\u003e react-native add feature like accesing camre\n\u003e react native approch navigation\n\n\npython \n\n\nangular reactive form\ndesign angular folder\nwith field\n1\u003e appname\n2\u003e app description\n3\u003e Redirect uri\n4\u003e Gender and it have male and female\n\nand register button only enable when all value added\n\nsudoku grid validation suggest best algo with step\ndetermine if a 9*9 sudoku board is valid.\nOnly filled cell need to be validated according to following rules:\n1.Each row must contain the digit 1-9 without repetition\n2.Each column must contain the digit 1-9 without repetition\n3.Eaxh of the nine 3*3 sub-boxes of the grid must contain the\ndigits 1-9 without repetition\n\nnote\nsudoku board could be valid but is not necessarily solvable\n\u003e only filled cell need to be validated according to the \nmention rule\n\nsuggest best algo with step\ngiven an m * n matrix board wher each cell is a batteship 'X' or empty '.'\nreturn the numbe of batteship on board\n\n1\u003ebatteship can only be placed horizontally or vertically on board\n2\u003ein other word they can be made of the shape 1* k (1 row and k columns)\nor k *1(k rows and 1 column) where k can be of any size\n3\u003e at least one horizontal or vertical cell separateds bewteen two batteship\n(ie there are no adjuxt battleship)\n\n\ngolang \nget a integer as input and write goroutine, channel\nto find sum of cubes\n\nexmple if input is 3\nthen ouput is 36\n\npython\ndict\nstocks={\n    \"apple\":252.12,\n    \"microsoft\":198.11,\n    \"intuit\":672.08,\n    \"databrick\":112.78,\n    \"yahoo\":8.96,\n    \"blackberry\":1.2,\n}\n\nfind the top 3 company and return there name and value\n\n\npython output\ndef calc(x,y,/, ope='add'):\n if ope == 'add':\n  return x+y\n elif ope == 'sub':\n return x-y\n elif ope == 'mul':\n  return x*y\n  elif ope == 'divide':\n  return x/y\nelse:\n    raise ValueError('invalid operation')\n\nresult = calc(x=7,y=2,ope='mul')\n\npython\ncan you simple class which has class method and instance method\n\n\njavascript\nconst getUser = () =\u003e {\n    return new Promise(resolve =\u003e {\n        resolve(\n            [\n                {id:1,name:'Jack'},\n                {id:2,name:'John'},\n                {id:3,name:'Mike'}\n            ]\n        )\n    })\n}\n\nconst getUserStatuse = () =\u003e {\n    return new Promise(resolve =\u003e {\n        resolve(\n            [\n                {id:1,isActive:true},\n                {id:2,isActive:true},\n                {id:3,isActive:false}\n            ]\n        )\n    })\n}\n\nmap both of them on basis of id\n\n\njavascript\nsetTimeOut(() =\u003e {\n    console.log(1)\n},0)\n\nconsole.log(3)\n\nPromise.resolve(4).then(console.log)\n\nnew Promise((resolve,reject) =\u003e {\n    console.log(5)\n    reject(6)\n}).catch(error =\u003e {\n    console.log(error)\n})\n\ntypescript\nany vs unkown\n\nangular\ndirective vs component\n\n\ntest case jest handle userinput and make backend call\n\nconst searchInput = document.querySelector('#search-input')\n\nfromEvent(searchInput, 'keyup').pipe(\n    /* Write code here*/\n).subscribe()\n\n\nios\n\nfunc divideLoot(\n    people:Int,\n    fairly:Bool) -\u003e string{\n        var output;\n        string = \"we're going to split.....\\n\"\n        if fairly{\n            output += \"Everyone get 1/\\\"\n\n        }\n        return output\n    }\n    print(divideLoot(people:5, fairly))\n)\n\nsql query\nwhat is having and where clause\n\nconst arr= [\n    {name:'Alex',age:25},\n    {name:'Bob',age:30},\n    {name:'Alex',age:25},\n]\n\ngroupedBy(arr,age)\n\noutput\n{\n25:[\n    {name:'Alex',age:25},\n    {name:'Alex',age:25},\n],\n30:[{name:'Bob',age:30}]\n }\n\n\n javascript\n const arr = [1,4,2,10,15]\n create function to find larget element in array\nfind nth larget \n\n\njavascript\nstring is palindrome code if we have remove 1 or less char\n\nexample\n//\"abcbda\" -\u003e true\n//\"desbacbe\" -\u003e false\n//dabcba\"\u003e true\n//\"asdfghj\"\u003e false\n\njavascript \non the basis of output understand the function and write\n\n    input = \"this is a test sentence\"\n    output:[t,h,i,s,i,s,a,t,e,s,t,s,e,n,t,e,n,c,e]\n\n    input = \"thiis iss a teest seentennce\"\n    output:[i,s,e,e,n]\n\n\n    input = \"thiiis iss a teeest seentennncce\"\n    output:[i,e,n]\n\n    we have 3 component compa,b,c, we need where c is actual view component I what design where compA render insider component b\n    will render 3 time im component A use children porps\n\n\nJavaScript\nwrite function take an array and revere the array and return new array\n\n\nReact\nwe have 2 category  closet and Suitcase\ncloset have few item display in terms of card\nSuitcase have few item\n\nevery item have move button on click of that\nif item in closet will move to Suitcase div\nand vice versa\n\ngolang\n we need to attempt the sorta list of flight based on their price\n from high to low\n 20,30,50,100\n you will implement the sortByPrice function that take in a slice of\n    type flight and return the sorted list of flight\n    in order to help you see what is going you hav been provided a very quick\n    prtint flight function which you can use to print the fligh out\n\n\n\n        javascript\nconst people : Person[]= [\n    {name:'abc', age:30},\n    {name:'def', age:25},\n    {name:'pqe', age:35}\n]\n\nreact\ngiven  react component that display a list of a \ngrocery item each wit a name cost and quantity complete the following task:\n1) implement the logic for button that increaase and decrease the quantity of each item\n2) Dipaky the total cost of all items based on their quantity and const\n3) Add a input field for the user to set their budget when total cost\nexceed the budget log the amount by which the total cost exceed the busget\n\n\ncss\nmake a red circle red backgroudn in center of page or div\n\ngiven a collection of candidate numbers (candidates) \nand a target number (target)\nwriet a function combinationSum2 to find all unique\n    combination of candiates where choosen number\n    sum to target. Each number in candiates may only be used \n    once in the combination\n\n    input combinationSum2([10,1,2,7,6,5], 9)\n    output [[1,2,5],[1,7],[2,6]]\n\n\nvar x = 0;\nfor (let i =0;i\u003c5;i++){\n    setTimeout(() =\u003e {\n        x++;\n        console.log(x)\n\n    },1000)\n}\nconsole.log(x)\n\n\nlet obj1 = {key:\"value\"};\nlet obj2 = obj1\nlet obj3 = obj2\n\nobj1.key = 'new Value'\nobj2 = {key: \"another value\"}\n\nconsole.log(obj1.key, obj2.key, obj3.key)\n\n\npython\nfunction to add 2 nuber\n\n\npython \ncheck palindorm\ngiven sting s conating just the characters '(',')','{','}','[',']' \n\ninput is valid if\n1) open barcket must be cloase by the same type of brakcet\n2) open bracket must be closed in the correct order\n3) Every close brakcet has ca cooresponding opne bracket of the same type\n\n\n\ntableA: Device_id, device_status= connect,not conncetc,device_type= samsung , motorola\n\nSQL\ntableB: device_id, snapshot_date, record_status = 'Update','Delete',\"Insert\"\n\nwrite query to find count of record for snapshot date on basis of record status \n\n\n\nSQL\ntableB: device_id, snapshot_date, record_status = 'Update','Delete',\"Insert\"\nwrite query to delete  2 record and keep 1\n\n\ncreate a single todo app using reactjs\nSame data local state management\neach todo item will have description , due date,\nstatus, completed/cancelled date, \nhandle form validation for required field \norder the todo item based on due date in increasing order\nwen and item marked as completeded or cancelled move them to\nbottom of the page of todo List\nApply appropitae styling to the page using css \n\nReact (typescrit) pool manager\n\ndesign pool manger app that allow users to \nvote one of the two option and view the winner\nthe app should be built using React + typescript\nApp the 3 comoponnent pollmanager , vote and results\n\nvote component\n\u003e display text of ecah option\n\u003e procide a vote burron fro each option\n\u003e disable vote button for each option whne the winner is declared\n\nResult component\n\u003e display the result text based on the \n\u003e if no vote cast show empty\n\u003e if same number of vote show tie \n\u003e if one has extr then sow leaser is leading by vote diff\n\nview winner\n\u003e if no vote cast button disabled\n\u003e clicking winner button \ndisplay resukt text \"it is a tie\" if same number of vote\nif one has extr then sow leaser is leading by vote diff\n    disable the view winner button \n    disable votr button for each option\n\npoll manager\n\u003e\u003edisplay poll Question\n\u003e manage state of the poll incduing vote and winner status\n\u003e pass the relevent data and function to the vote and result component\n\n\n\nin vote component\ninterface VoteProps{\n        options: PollOption[];\n        onVote:(optionId: number) =\u003evoid;\n        viewwinner: boolea\n    }\n\nexport interface PollOption{\n        id:number\n        text:string;\n        votes:number\n    }\n\n\nexport interface Poll{\n        question:string\n       options:PollOption\n    }\n\n\n\n\npython\ngiven two nodes on atree find the first ancestor they have in\ncommon Nodes have pointers to  their parent and their childern\n\n\npython\nwe have a game in which consecuitve duplicates pieces of the same type\ncancel each other  out and remaining pieces slide in until no more pieces can be removed\n\nGive a board resprestn by string return the final state of the board after playing the game\n\ninput = \"abbba\"\noutput:\"\" (\"abbba\" =\u003e \"aa\" =\u003e \"\")\n\ninput = \"ab\"\noutput = \"ab\"\n\ngolang\npackage main\n\nimport {\n    \"log\"\n    \"net/http\"\n}\n\nimplement \n//get /rules (list all rules)\n//post (/rules) (insert a single rule)\n\ntype FirewallRue struct{\n    VMID uint64 `json:\"vm_id\"`\n    Direaction string `json:\"direaction\"`\n    Source string `json:\"Source\"`\n    Destination string `json:\"Destination\"`\n    Protcol string `json:\"Protcol\"`\n    Port int `json:\"Port\"`\n}\n\nfunc main(){\n    database := make(map[unint64]* FirewallRue)\n    database[1] = \u0026FirewallRule{VMID:1}\n\n    r: http.NewServeMux()\n\n    r.HandleFunc(\"GET\"){\n\n    }\n}\n\ns:= \u0026http.Server{\n    Addr: \":3000\",\n    Handler: r\n}\n\n\nfunction fn(){...}\n    // functional component\n    function form(){\n        // call fn whrn form unmount\n    }\n\n\n    output\n\n    const olObj = {\n        contant:{\n            email:\"old_email\"\n        }\n    }\n\n    const newObj = {\n        ...oldObj\n    }\n\n    console.log(oldObj.contact.email)\n    console.log(newObj.contact.email)\n\n\n    output\n    javascriot\n    how do you promidify th delay function ?\n        it should print \n\n    const delay = () =\u003e setTimeOut(() =\u003e {\n        console.log('timeout')\n    })\n\n    async function main(){\n        console.log('start')\n\n        await delay;\n\n        console.log('finish')\n    }\n\n    main()\n\n    it should print start,timeout, finish and make sure it run asynchronously\n\n\n    jacascript\n    what is missing\n    what do you need to define name and age when intasniting the person class?\n\n        class Person{\n            name = \"\",\n            age = 0\n        }\n\n\n        const John = new Person('a',10)\n\n\ngiven this array of users can you implement the getActiveUserWithCat return active use with cat\n\n\ninput=[\n    {name:\"a\",isActive:false,hasTrue:true},\n    {name:\"b\",isActive:true,hasTrue:true},\n    {name:\"c\",isActive:true,hasTrue:false},\n    {name:\"d\",isActive:true,hasTrue:true}\n]\n\ngolang\nthere are 2 golang routine one is producer\nother is consumer once it recive it will send acknolwdgement and then \n    producer will send new mesaage\n    in case of 10 sec delay in acknolwdgement it will end bot goroutine\n\n\noutput of javascript code\n\nconst makeMap = () =\u003e {\n    const parks = new Map()\n    parkse.set(\"uinversla\",{name:\"USF\",age:30});\n    parks.set(\"disney\",{name:\"magic\",age:40})\n    parks.set(\"uinversla\",{name:\"IOA\",age:50})\n\n    console.log(JSON.stringify(parks))\n}\n\n\n\nfunction sumArray(array:number[]){\n    let sum = 0;\n    for(let i = 1 ; i\u003carray.length;i++){\n        sum +=array[i]\n    }\nreturn sum\n}\n\n\njavascript\nimplement a function to find the sum of number without any loop\n    arr = [1,2,3,4,5]\n\n\n    javascript\n    \"A\"-1\n    2+\"-2\"+\"2\"\n    \"Hello\"-\"World\"+78\n    \nReact creates simple component \ncounter for increase and decearese and dipslay ouput\n\nthere is a sitting length N made only od letter 'a'\nwhenever there are two identical adjust letter like 'aa' \nyjey can be transformed into single letter that is the next \nletter of the alpjabet.\nlike 'aa' transfomeed to 'b' and 'ee' will transformed to 'f'\nand 'zz' cannot be further transfomred\n\nwhat is thw alpjabet larget string that can be obtained from the intial\nstring?\n\n\nfunction soluiton (N)\n\n    example\n    N = 11 function should retirn 'dba';\n        'aaaaaaaaaaa' =\u003e 'bbbbba' =\u003e 'ccba' =\u003e 'dba'\n\n\n\n\n\nconst sumOFNums = numbeersArr.reduce((acc,num) =\u003e {\n    return acc+num\n})\n\nconsole.log(sumOFNums) //15\n\nQuestion implement a polyFill name \"myreduce: that replicate the same behavioyr as \"reduce\"\n\nArray.prototype.myreduce = function(cb,initialVal){\n    const array = this\n}\n\n\nconst numberArr = [1,2,3,4,5]\nconst sumOFNums = numbeersArr.myreduce((acc,num) =\u003e {\n    return acc+num\n})\n\nconsole.log(sumOFNums) //15\n\n\n\n\n \nimplemnation of stack operation like push pop empty, peek, and swap use javascript and html\nwith the given template\n\npush \u003e insert an element to the top of stack\npop \u003e remove the top most element\nempty \u003e retyr true if the stack is empty ,false otherwise\npeek\u003e returns the value of the topmost item\nswap\u003e the two topmost element of the stack can are swapped\n\n\nstack can hold 5 value at max\ntextbox should accept any type of value\n\n\u003cbutton type=\"submit\" id=\"pushbutton\"\u003ePush\u003c/button\u003e\n\u003cbutton type=\"submit\" id=\"popbutton\"\u003ePush\u003c/button\u003e\n\u003cbutton type=\"submit\" id=\"emptybutton\"\u003ePush\u003c/button\u003e\n\u003cbutton type=\"submit\" id=\"peekbutton\"\u003ePush\u003c/button\u003e\n\u003cbutton type=\"submit\" id=\"swapbutton\"\u003ePush\u003c/button\u003e\n\ndo not add on click\n\n\n    after adding value add in the table\n\u003ctable\u003e\n    \u003ctr\u003e\u003ctd class=\"stack-item\" id=\"5\" data-testid=\"5\"\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd class=\"stack-item\" id=\"4\" data-testid=\"4\"\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd class=\"stack-item\" id=\"3\" data-testid=\"3\"\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd class=\"stack-item\" id=\"2\" data-testid=\"2\"\u003e\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd class=\"stack-item\" id=\"1\" data-testid=\"1\"\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\ngolang\ni have varibale its a string type store message size is %d\nvar msg = \"Size:%d MB\"\nin println pass data like 30 mb and format response\n\ngolang\ni have map that cotains string string like username pranit\ni want to check map have username key exist\n\ngolang\ni want to create method either accept integer or float method name is \"Add\"\nif i pass integer it return type should integer\nif i float integer it return type should float\n\nteam has created rest end point and consume the rest end point call api\n\ngolang \nwe have array of 10 mobile numbar in api\nbut we got more than 300 number in array we ned to process\nbut downstram accept only 10 and they alos applied rate limiting of calling 5 time\n\nwe have 6 to 7 lambda function making http call to fetch the lambda\nAll the api we are calling need to pass token \nfor diff env ,\nwe have diff diff value for token generation\nwe creeated diff config file now everything working fine for qa env we need to change config\nand config file shipped with lambda how to manage env with lambda\n\n\nreact\n\nui button if we click on button it should giev call to backend api and retrerve the data\nfrm the backend and display on ui\n\nfins the second larget or smallest number in the array\n\n\nwrite python function\n\n    example1\n    input: digits = \"23\" \n    output: [\"ad\",\"ae\",\"af\",\"bd\",\"be\",\"bf\",\"cd\",\"ce\",\"cf\"]\n\n    example2\n    input: digits = \"\" \n    output: []\n\n    example2\n    input: digits = \"2\" \n    output: [\"a\",\"b\",\"c\"]\n\n    return all combination of charcter like mobile key pad\n    where\n    1 have nothing\n    2 have abc\n    3 have def\n    4 have ghi\n    and so on\n    and 0 have nothing\n\n\n\n\n\n\nupdate object 2 with all filed of object 2\n\nconst obj1: any = {\n    field1:\"test\",\n    field2:\"tes1\",\n}\n    \n\nconst obj2: any = {\n    id:\"1a\"\n}\n\nconst park = {\n    id:2,\n    name: \"a\",\n    loc:{\n        city:\"a\",\n        state:\"b\"\n    }\n}\n\nconst {name,state} = park\nconsole.log(name)\nconsole.log(state)\n\n\nexport class ExampleCass{\n    public async queryAll(reqs: ExampleRequest[]):Promise\u003cboolean\u003e{\n        let results: boolean[] = []\n        const promise = reqs.map(async(req:ExampleRequest) =\u003e  Database.query(request));\n        try{\n            results = await Promise.all(promises)\n        }catch(err){\n            logger.warn(error)\n        }\n        return OtherService.sendResult(results)\n    }\n}\n\n\nexport class ExampleCass{\n    private constantProperty: string;\n    public constructor(constProp: string){\n        this.constantProperty = constProp\n    }\n}\n\n\nclass PersonClas{\n    public firstName:string;\n    public lastName:string;\n\n    public get fullName(){\n        return this.firstName + this.lastName\n    }\n}\n\nclass person : PersonClas = {\n    firstName :\"a\",\n    lastName:\"b\"\n\n}\n\nlogger.info(person.fullName)\n\n\n\napi.data.gov.sg/v1/environment/air/temperature\n\ndisplay \ndevice id\nname \n\nin react after calling the api\n\n\njavascript\nconst obj = {a:1, b:{c:2}};\n\nObject.freeze(obj)\n{a: 1, b: {…}}\nobj.a = 2\n2\nobj.b.c = 3\n3\nconsole.log(obj)\n\njavascript \ncreate sum function that can take any paramater and it can be any number\nsum(1,2,4)(8,9)(7,11)()\nand this can be any number of argument\n\n\njavascript\nwe have arra of object of student data\nof same clss but different section\nreturn all with just section a\n\n\ngolang \ncodr to find hight comman factor of any number\n\njavascript\n\nif(!A){\n    console.log(\"A\")\n}else if(!B){\n    console.log(\"B\")\n}else{\n    console.log(\"error\")\n}\n\ninput = {\n    error=\"hi\"\n}\n\n\npython\ngiven an array of intergs nums sorted in non-decreasing order\nfind the starting and ending position of a given target value\n\nif target is not found in the array return [-1,-1]\n\nexample\ninput = [5,7,7,8,8,10]\ntarget = 8\noutput = 3,4\n\n\nReact \nRecreate the traffic light using css and html\nmake it so ecah \"light\" is clickable\nwhen clicked it should it should set the circle to the correct color\nthe other two into the \"off state\" color\n\n\nphp\nWhat are constructors and destructors in PHP?\nExplain the concepts of visibility (public, protected, and private) in PHP.\nHow can you secure a PHP application against XSS (Cross-Site Scripting)?\nHow do you create and retrieve session variables?\nExplain autoloading in PHP. How does the spl_autoload_register() function work?\nDiff between put vs patch\nHow does PHP handle caching, and what caching techniques can be used?\n\nCoding\u003e  Find Duplicate Elements in an Array\n\u003e Sort an Array Without Using Built-in Sort Functions\n\n\nLarvel\n\u003e What is the purpose of phpunit.xml in Laravel?\n\u003e What is the Event and Listener system in Laravel, and how is it used?\n\u003e How does authentication work in Laravel?\n\u003e What is Auth::attempt() in Laravel, and how is it used?\n\u003e What is the difference between can() and gate() for authorization in Laravel?\n\u003e What is Laravel Sanctum, and how does it handle API token authentication?\n\u003e\u003e How we can setup event broadcasting in Larvel\n\nsql\n\nwrite a query the fetch the 2nd \nhighest salaery from each dept\nMySql\n\u003e Create a query in MySql for student and marks table  to find top five student on basis of marks\nwhere both table have releation ship of rollNo\n( if done above)\n\u003e Please save above output in view\n\u003e Write a SQL command to update data through a view and handle any potential issues with view updates.\n\u003e\u003e Provide the SQL command for updating data and discuss any limitations or requirements.\n\u003e\u003e What is a materialized view, and how does it differ from a regular view?\n\n\nReact\n\u003e create 2 component \none parent component\nsecond child component\nshare data between parent and child\n\n\ngolang\nfor the following code can you write a program for the client side?\n\n\npackage main\n\n\ngolang in 5 producer producing 5 number one by one and consumer\nis responsible for consume number\n\u003e it should work in producer 1 producer will produce and consumer will consume\nthen next producer will produce 1 number and consumer will consume\n    and so on\n    so all producer 1 by 1 produce number 1\n    \ngolang\nto implement stack interfcae which folowing method:\npop(), push(), peek(), isEmpty(), max()\n\n\ngolang\nyou were hired as a consultant for best blog\u003csup\u003eTM\u003csup\u003e\ncompany need help with findihing the implentation of RestApi \n\nfirst \nwe need to implement empty methods in 'commentRepository' and 'Post Repository'.\nthe structs resprest an in memory storag\nfor out entitess you will find stubd of the methods in the repository/respositiry.go file\n\n\nreact\ncreate tic tac toe game\ncreae a stateful custome hook exeuted bases on a data change\n\npython\nwe have a catalog of song title(and their length) that we play a local radio\nWe asked to play two of the song in row they must add up exactly seven min long\n\nexampe:\nsong_times_1 = [\n    ('abc',\"8:05\"),\n    ('def',\"2:27\"),\n    ('ghi',\"3:41\"),\n    ('jkl',\"2:49\"),\n    ('mno',\"3:19\"),\n    ('pqr',\"3:18\"),\n    ('st1',\"10:26\"),\n    ('lkh',\"4:55\"),\n]\noutput ['ghi','mno']\n\n\npython \nfind the longest chaining of song  and make sure no song should not repeate\nreturn the starting till longest chain with matching word, starting song is provided as input\nsong_times_1 = [\n    'd b r',\n    'r o d',\n    't m t t r',\n    'dreams',\n    'blues hand me down',\n    'forever young',\n    'American dreams',\n    'all my love',\n    'contaloop',\n    'Take it all',\n    'love is forever',\n    'Young American',\n    'Dreamship',\n    'Every breath you take'\n\n\n]\n\noutput = \nsong1_1 =  'Every breath you take'\n\noutput\nchaining song = [ 'Every breath you take','Take it all','all my love','love is forever','forever young',\n'Young American','American dreams','dreams',]\n    \n\npython\nwrite function that simulate communication between 2 microservice\n    one generate user id and other use thate id for search\n\njavascript\nasync function async1(){\n    console.log(\"1\")\n\n}\n\n\n\nios filter movies\nneed to build a small part of ios app print out log items\nthe swift function logdumpGetUnique has a small set of itemstored in a string.\n    Each log item is separeted by a semicolon\n    your goal is to return a new tring with the following requirnemnt:\n\n\n1\u003e Remove log items that are duplicate based on username\n2\u003e Form each log item remove id= Num propoerty and value.\n\nfor item that are duplicate based on the username keep\nthe first one that appers on the list and remove the subsequent one\n\n\nexample Iput\nname = Dan B, username=db, email=db@gmail.com, id=123;\nname = hannaa, username=hsmith, email=hsm@gmail.com, id=33;\nname = Dan Brick, username=db, email=db@gmail.com, id=663\n\noutput\nname = Dan B, username=db, email=db@gmail.com;\nname = hannaa, username=hsmith, email=hsm@gmail.com;\n\n\nios \nneed to build a small part of ios app that need to implment a simple \nkey-value type of a cache in swift you need to implement a cache class that functions\nadd,get and size\n\nthe add function take 2 param  a key and value and adds the pair to the local cache\nwhen an item is added to the cache this function should return the string \"added\" and if the item alreday existed\n    in the cache theis function should\n        return the string \"overeritten\n\n        the get function attemp to returive an item from the cache\n        based on the key parameter oassed in if the item exist in the cache\n        retur the value ,otherwise return string \"miss\"\n\n        the size function will return numner of item in the cache]\n\n\n\n            \u003cscript\u003e\n               function mul(a,b){\n                   return a*b;\n               }\n               function div(a,b){\n                   return a/b;\n               }\n               document.writeln(mul(5,7).toString());\n               document.writeln(\"\u003cbr\u003e\");\n               document.writeln(typeof mul(5,7).toString());\n               document.writeln(\"\u003cbr\u003e\");\n               document.writeln(div.toString());\n               document.writeln(\"\u003cbr\u003e\");\n               document.writeln(typeof div.toString());\n\n            \u003c/script\u003e\n            \u003cbutton onClick='setName()'\u003eSetName \u003c/button\u003e\n            \u003cp id=\"name\"\u003e\u003c/p\u003e\n\n\n            var num=10;\n            function fun(){\n                num=100;\n                return;\n                function num(){}\n            }\n            fun();\n            console.log(num);\n\n\n\n\n            golang\nusing jin framwork write api which are reading and saving book information\n2 api\n\nfor num = \"1432219\" and k = 3\noutput = \"1219\"\n\nreact with typescript wit prime react\n\nwe have api\nhttps://jsonplaceholder.typicode.com/users\nimtergate into react app and return tabel format showing\nid, name , username, email and address\nand address should be like\nstreet,suite,city and zipcode\n\nand use Prime React for table\n\nreact with typescript wit prime react\nimplement user auth- keep username as user and password as pass\nprovide login and logout button\n\n\u003e desigb a multi-page application with appropriate routing\n\u003e creagt at least two main route\n\u003e a public route accessible to all user (eg homepage)\n\u003e A private route accessible only to authenticated users\ncreata route gaird that prevete unauthorixed access ro private route\nensure that only authenticated user can access certain part of the application\n\n\npython\navergae-waiting-time\n\nthere is a restaurnat with s single chef you are give an array customer,where customers[i]= [arrival,time]\narrival \u003eis the arival time to ith customer. the arrival time are sorted in non-descreaing order\ntime \u003e is the neede to prepare the order of the ith customer\nwhen a customer arrives, he give the chef his order and the chef start prepaing it once he is idle\nthe customer waits till chef preparing his order the chedf does not prepare the  food for more than one customer\nat a a time\nthe chef prpeare food fr cutsomer in the order they were given in the input\n\nretun the avergae waiting time of all customers solution within 10^-5 f0r the actual ansewer considered\n\ninpur = [[1,2],[2,5],[4,3]]\noutput = 5.00000\n\n\njavascript\n\ni have array from -infinity to +inifinty find second largest number in array\n\n\nhow to call api in reactjs\n\n\ngolang\n\nwrite code we recicev string\n1\u003e ({})\n2\u003e (({{}}))\n3\u003e [{}{}{}]\n\nvalidate formate barakcet should be sequnetically close\nif correct return true else false\n\n    package main\n\n    import (\n        \"fmt\"\n    )\n\n    func main(){\n        var slice = [5]int{1,2,3,4,5}\n        var newSlice []int\n        newSlice = slice[0:2]\n        newSlice = append(newSlice,6)\n        fmt.Println(newSlice)\n        fmt.Println(slice)\n    }\n    \n\n    golang write code\n    given 1-\u003e2-\u003e3-\u003e4-\u003e5\n    and n = 2\n\n    output = 1-\u003e2-\u003e3-\u003e5\n\n    input is list n i number\n    we need to remove the node from the end of the list\n\n\n\npython\nlet asume on one of the s3 loaction we have file (partfile)\nwe have 2 file part1 and part2  to convert into text and make one and copy in different locatin\n\n\npython\nGiven a string of sorted integers sepearted by space indentify wheters a target is present in array or not \nInput\n\njavascript\ncan filter array based on function\n\n    javascript\n\n    implement json.stringify function mannuly without inbuit\n\n\npython List Comprehension\nnum_list = [1,2,3,4,5,6]\nreturn new list with even number\n\n\npython\n\nwhat is missing  the claas\n\nclass Person:\n def __init__(name)\n        name=\"a\"\ndef print_name():\n print(name)\n\n\njavascript  \ncosnole.log(x)\nlet x = 40\n\njavascript\nconst a = {val:45}\nconst b = a \nb.val = 90\nconsole.log(b)\nconsole.log(a)\n\njavascript\nfunction abc(){\n    let x =20;\n}\n\nconst newFun =abc()\nconsole.log(newFun(45))\nwe can only modify function abc() and output shoudbe 65\n\n\n\nwrite sql query to find all products that have\nnever been order from the products and order_items tables\n\n\nhtml css\ndraw on circle and inside that make one more\n\npython\ncheck weather string is palindrome\n\n\ndatascience\n\n\npython\npython create 2 sets of values for the analysis\nset1=[3,-5,-.5,2,7]\nset2=[2.5,0,2,8,10]\nusing these 2 set of values set1 is predicted value\nand set2 is actual value\nfind root mean square without any libraray\n\n\nnow in\nset1=[3,-.5,2,7]\nset2=[2.5,0,2,8]\n\n\npython\nwrite function one aws log need to fetch from cloud and show time \n\n\njavascript\nwe are giveb an array of object represting studenst tst score each with a name \nand score property\n\nwe need function in javascript\n1\u003e an array if name of student who score above 80\n\u003e an aray of object whee each object conatins the student name and a boolena indicating of they passed (score \u003e=65)\n3\u003e the average scroe of all student\n\n\njavascript\nwrite a function to return a promise the function should take \na number as an argument when the number is even the promise should return a number that is\n2 times the original number. when the number is odd it should throw error\n\njavascript\n\nusing the function form above question write a second function that takes as an array an argument and calls second\nfunction for each number in the array the function should return the new number\nwhen an error occur the number shoud be set to -1\n\nconst input = processNumber([1,2,3,4])\nconsole.log(result) /[-1,4,-1,8]\n\n\nnodejs\nhow to approch api\n\u003e create new user save field like name and able upload image with s3\n\n\n\n\nthis.setState({counte: this.state.counter+this.props.value})\n\n\npython code\ntheather booking system\n50 seats in theater \n10 in row\n\ni want book seat in row 1 \n2, 6\n\nand thn row 2 \nseat 3,7\n\nshow row in table format\n\n\n\njavascript \nvar a = [12,234,23,12,431]\n\n\n\nmake counter component in reatc\n\nwrite a function to merge two array ad result should be sorted array without inbuili\n\n\nnext js and typescript\ncreate a form that allow files upload\nsubmitting the form should upload to : `/api/upload/\nafter upload something about the  file in message\n\nthe endpoint should be responsble for:\nprocessing the uploaded input according to the algo\nreturning the result\n\nfinally shoe the rsult on the UI\n\n\ntypescript\nimport type {Equal, except} form '@total-typeScript/helpers'\n\n// ennsure routes can only have the 'component' property\n// ensure the component value of a route cannot be changes after creation\n\nconst routes = {\n    \"/\":{\n        component:'Home'\n    },\n    \"/about\":{\n        component:'About',\n        search:'?foo=bar'\n    }\n}\n\n@ts-expect-error\nroutes['/'].component = 'About'\n    \n\n\n\ntype tests = [\n    Excpet\u003cEqual\u003c(typeof routes)['/']['component'],'Home'\u003e\u003e\n]\n\nmake a screen with tiles with text and checkbox \nfor web show 6 box in row\nfor tab 4 in one row and all in next\nfor mobile one under anothe use flex box\n\n\njavascript\ntake a paragah as an input, ans count word from it\n\n\nsystem design question\ndesign system for sending notification (system design question)\n\nwhat is the seocnd aregument foe setState useful for?\n\u003e to replace the state completely insted of the deafult merge action\n\u003e to invoke code afte the setState opertaion done\n\u003e th access the pervios state before the setstate operation\n\n\nwhat instance property can be used ti access the property of a class component?\n1\u003e this.properties\n2\u003e this.props\n3\u003e this.attribute\n4\u003e this.attrs\n\nwhat are the 2 object that act as the input of a class-based component?\n\nwhat advantage does the react devloper tools for chrome offer?\n1\u003e it shows the attribute of html element in a side pane.2\n2\u003e when clicking on an html element it shows the corresponding jsx\n3\u003e it visualizes the jsx tree hierarchy\n\nwhat could be a reason to use flux?\n1\u003e root component get too bloated with mainting state\n2\u003e there are more than 10 component in the application\n3\u003e the application is menet to be used as acloud application\n4\u003e the application is very simple in nature\n\n\nwhat is react approch to separation of concern?\n1\u003e the code defining the ui in a componet is always separated from the rest of \nthe logic in the component\n2\u003e with react html is written in component so that here strict separation between js \ncode and browser\n3\u003e what displayed in the browser is only refelection of the state\nofthe application\n\ncan a child component subscribe to the extranl state that its parent\nis also subscribe to?\n1\u003e yes, but only if it was wrappped component\n2\u003e yes , any class component can subscribe to the external state\n\nhow can we solve the problem when both a server and a client-renedered\napp need to use async data?\n1\u003e by mistake the ajax call before the first reactDOM.render call on the clinet\n2\u003e by mistake the server-rendered app manully invoke the componentDidMount method\n3\u003e by using an iniatl data concept that can be controlled on both server and client\n\nwhat is the reason behind the advice against using a contextApi?\n1\u003e it requires the use of external packages ans state containers\n2\u003e it makes the application use more memeory\n3\u003e it a global concept that complicates responsibilities and testing\n4\u003e it makes the code less readable\n\nhow do you call a function that return another function\n    1\u003e functionName().()\n    2\u003e functionName(())\n    3\u003efunctionName(() =\u003e ())\n    4\u003efunctionName()()\n\njava \ninvoke restful service and url is abc.com\ncall a service abc \n\njavascript\nwrite function which accept an array\n    [1,2,3,1,2]\n    as input\n\nconvert each array element into a key of a new object\nstart with empty object\nkey must be unique\n\ninput \u003e [1,2,3,1,2]\noutput\n{\n    1:\"Hello\",\n    2:\"Hello\",\n    3:\"Hello\"\n}\n\n\ninput must have same width as button\n\n\n\u003cdiv class=\"container\"\u003e\n\u003ch1 class=\"heading\"\u003ePlease login\u003c/h1\u003e\n\u003cdiv\u003e\n    \u003clabel class=\"label-for-input margin-bottom-5\"\u003eUsername\u003c/label\u003e\n    \u003cinput class=\"input-field margin-bottom-5\" type=\"text\"\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n    \u003cbutton type=\"button\" class=\"login-button\"\u003eLogin \u003c/button\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n.container{\n    width:50%;\n    height:30%;\n    background-color: grey;\n    color: white;\n    position: absolute;\n    top:0;\n    bottom: 0;\n    left: 0;\n    right: 0;\n    margin: auto;\n   } \n   .heading{\n    text-align: center;\n   }\n   .label-for-input{\n    display: block;\n    font-size:30px;\n   }\n   .input-field{\n    width: 100%;\n    height: 20px;\n    border-color:black;\n   }\n   .login-button{\n    width: 100%;\n    background-color: yellow;\n    font-size:30px;\n     border-color:black;\n   }\n   .margin-bottom-5{\n    margin-bottom:15px;\n   }\n\n\nReact\ndesign a small app in react with functional component\nit have ine input box that shold accept user age shoud accept number\nthen there should be a button on click \n\u003e if age is greather then 18 the display message \u003e eliglible for driving\n\u003e if age is smaller then 18 the display message \u003e not eliglible for driving\n\nnodejs\ncreate a url shrotner service similiar to bitly\nservice should allow user to access long url when shorten url is accessed\n\n\n\nnodejs\n\nusing aws servies help me create serverless image processing pipeline\nthe pipeline should automatically resized image uploaded images\n\nand in another bucket uploade resign images\n\n\njavascript\ncount character in string and list\n\ncomplet following code on hashing\n\nvar a = 10\nvar b = 2;\nvar c = 'USD'\nvar cardNum = 1454112114114111;\n\nconst module = (modulename) =\u003e{\n    if(modulename != 'instalment')\n    {\n        return false\n    }else{\n        return modulename\n    }\n}\n\nconst password = ( ) =\u003e{\n    const buf = Buffer.___('pass','asci')\n    const pass = ___.tostring('hex')\n}\n\n\nwrite  a ts function called addElement that takes\n    an array of numbers and a number\n    it should return a new array with the number appended\nto the end without modifying the original array\n\nwrite  a typesscript function\ncaled mapArray that takes an array of number\nand a function as arg. the function should\n    aply the given function to each  element of the Array\n        and return a new array with the resukt\n\nform the below ser how would i extarct the strret,city ,state \nand bot  hobbies in one line using both object desstrutuing\nand array desstrutuing\n\nconst user = {\n    name:'a',\n    age:10,\n    addreess:{\n        street:\"b\",\n        city:\"c\",\n        state:'e'\n    },\n    hobbies:['f','g']\n}\n\nwrite a tyoescript function safeParseJson that take a JSON string\n    inout and safely parse it.\n    if parsig fails it should return null insted of throwring error\n\n    write a tyoescript function fetchUrlIsInParallel\n        that fetches data from all the urls in parallel using axios\n        if all request succeed return the result . if any request \n        fails log the error and return an empty array\n\n\nhow would you optimise the below .filter  and .map calls?\n\nconst users = [\n    {id:1,name:\"a\", role:\"aa\"},\n    {id:2,name:\"b\", role:\"bb\"},\n    {id:3,name:\"c\", role:\"cc\"},\n    {id:4,name:\"d\", role:\"dd\"}\n]\nconst adminNames = users.filter(user =\u003e user.role === \"admin\")\n.map(user =\u003e user.json)\n\nconsole.log(adminNames)\n\nhow would i optimise the below function using a hshmap\nplesee return an object insted of the map\n\n\ninterface Intallation {\n    carId:string,\n    partId:string\n}\n\nconst intallations: Intallation[]{\n    {cardId:\"a\",partId:\"aa\"},\n    {cardId:\"b\",partId:\"bb\"},\n    {cardId:\"c\",partId:\"cc\"},\n    {cardId:\"d\",partId:\"dd\"}\n}\n\nfunction countParts(intallations:Intallation[]):{[key:string]:value}{\n    const partCount = new Map\u003cstring, number\u003e()\n    intallations.forEach(intallation =\u003e {\n        if(!partCount[intallation.carId]){\n            partCount[intallation.carId] = 0\n        }\n        partCount[intallation.carId]++;\n    })\n\n    return partCount\n\n}\n\n\njavascript\nhow would you write function called encode messgae that takes a string \n    and return it with consective identical characters respresented as the count followed\n    by the the character?\n\nex \ninput \"aaaabbe\" \noutput \u003e \"4aaaa2bb1e\"\n\ninput \"zzzqqrrrr\"\noutput = \"3zzz2qq4rrrr\"\n\n\n///////////////\nwhich of the following statement are true for nodejs?\n\n\u003e Nodejs is a framework\n\u003e Nodejs is a javascript runtime env\n\u003e Nodejs is a programming languages\n\u003e Nodejs is a superset of javascript\n\n\nwhat does the term \"non-blocking\" means in the context of nodejs\n\u003e function return immediatly and execute the task in the background\n\u003e function block other function for execution\n\u003e function pause execution until their return value is computed\n\u003e function immediatly return without a value\n\n\nwhen working with async/await which statment would be used to pause the\nexecution of an async function until a promise is resolved or rejected\u003e\n\u003edelay\n\u003epause\n\u003ehold\n\u003eawait\n\n\nwhich of the following is true about the async keyword in nodejs?\n\u003e it makes a function return a promise\n\u003e it always makes a function execute asynchronously\n\u003e it allow the await keyword to be used within the function\n\u003e it stop the event loop until the function completes\n\nif a promise neither resolve nor rejected, it is said to be in which state?\n\u003e completed\n\u003e pending\n\u003e nullified\n\u003e void\n\n\nwhat happens in the event loop when there's no more work to schedule?\n\u003e it exits immediatly\n\u003e it goes into a infinite loop\n\u003e it wait for more tasks before proceeding\n\u003e it throws an error\n\nwhat are there result of awaiting reject promise in an async function without a try/catch\nblock?\n\n\u003e it throws an error\n\u003e it return the rejected value\n\u003e it return a undefined value\n\u003e the function continue exeution without any issue\n\n\nwhich command is used to execute custome script defined\nin the package.json file  nodejs\n\nwhat would you use to get the list of verison of a \npackages available on npm\n\n\u003e npm list [package]\n\u003e npm show [package]\n\u003e npm view [package] version\n\nwhich of the following os the correct way to do a named export of function named \nmyfunc in nodejs?\n\n\u003e export myfunction\n\u003e exports = myfunction\n\u003e module.exports.myFunction = myFunction\n\u003e module.exports - myFunction\n\nsuppose you have the following code file named\ncalc.js\nhow would you import the add function in another file\n\u003e const {add} = require('calc')\n\u003e const add = require('./calc')\n\u003e import {add} from './calc'\n\u003e import add from './calc'\n\nhow would you import only specific function from a module that has\nmultiple named exports\n\nin the es6 if a module named './math.js' has a default export of a \nfunction named calc, how would you import it into your code?\n\u003e require('./math.js').default\n\u003e import {calc} from './math.js'\n\u003e import calculate from './math.js'\n\u003e import * as calculate from './math.js'\n\nin nodejs which method is recommended for handling exception in async/await code?\n\u003e using try/catch blocks\n\u003e async.catch()\n\u003e using error-first callback\n\u003e .on('error')\n\nOutput\nconst promise = new Promise((res,rej) =\u003e {\n    throw new Error(\"Error Occured\")\n})\npromise.then(() =\u003e {\n    console.log(\"Success\")\n}).catch(() =\u003e {\n    console.log(\"Failure\")\n})\n\nwhat is the nvm command for switcing between nodejs versions\n\n\nnodejs which file extension does eslint check by default without any configuration\n\u003e .mjs\n\u003e .es6\n\u003e .es\n\u003e .js\n\nin jest testing in nodejs what function is used to group releated tests\n\nto automatically generate api docuemntation for your nodejs app\nwhich tool might you employe?\n\u003e expressDoc\n\u003e nodeDocApi\n\u003e ApiDoc\n\u003e swagger\n\n-----------------\nangular\nhow do you specify where your routed components will appear in your application?\n\u003e they always apper just inside the \u003cbody\u003e tah of your index.html\n\u003e use *ngSwitch to display the appropriate component based on the url\n\u003e use the \u003crouter-view\u003e Component\n\u003e use the \u003crouter-outlet\u003e Component\n\nwhat is the @viewChild decorator used for?\n\u003e to get a handle on a DOM node decorated with a ref tag(#ref)\n\u003e to add metaData for the children of a view\n\u003e to make custom * directives\n\u003e none of above\n\n\nwhere should you sort and filter data?\n\u003e in your component\n\u003e in a pipe\n\u003e in a filter\n\u003e in a directive\n\nwhat specifically does angular mointor when it determines whether or not\nto fire ngOnChanges()?\n\u003e Reference changes\n\u003e Component changes\n\u003e function changes\n\u003e Event Changes\n\nngrx ngrx-data, obervable, store and other state managmenet solutions\nall created a single --------- that can be used throughout an application\n\u003e immutable structure\n\u003e code technique\n\u003e store\n\u003e manifest\n\nwhat design pattern can be used to help with component communication\nin an angular application\n\u003e abstract factory or factory method pattern\n\u003e top to bottom pattern\n\u003e object communication pattern\n\u003e mediator or observer pattern\n\n\nngrx is a state mangement solution that can be defined as:\n\u003e component+service\n\u003e redux +RxJS\n\u003e container + presentation\n\u003e event Bus + observable service\n\nwhat items are stored in the \"core\" folder?\n\u003e component object resource entity items\n\u003e object that will be created multiple times\n\u003e singleton object(service, single use component etc)\n\u003e items that are \"shared\" in the application\n\n\nfunction calls made from a template can be replaced with ----- in many cases?\n\u003e component\n\u003e services\n\u003e properties\n\u003e pipes\n\nwhat rxjs operators can be used to change from one observable to another?\n\u003e changeMap()\n\u003e switchMap()\n\u003e forkJoin()\n\u003e SiwtchObservable()\n\nin what order do interceptor execute?\n\u003e reverse alphabetical order by class name\n\u003e the order is indeterminate\n\u003e the order in which they were provided in a module\n\u003e the calling controller determines the order\n\n-----------------\npostgres\n\nif you want to retrun aall rows from two or more tables that meet the join condition\nwhich type of join would you use?\n\u003e left\n\u003e full\n\u003e right\n\u003e inner\n\n\npostgre\nwe have 2 table \ncutomsers with custid and name\norders with order_id cust_id and amount\n\nyou write a query to join these table which return the result \n\nresult \u003e custid name order id\n\nwhich join we should use\n\n\npostgre\nassume that you write a query that returj the following result\n\u003e Result\n   Cust_name\n   Shannon\n   Olivia\n   James\n   Heath\n   Brenna\n   ALec\n   Alec\n   \nwhcih sql clause did you most likely use to select your result?\n\n\u003e order by cust_name Desc\n\u003e order by cust_name\n\u003e order by cust_name Asc\n\u003e Group by cust_name\n\nSQL\nassume that a company has a table in its database that stores order\ninformation including the amount of the order:\n  order_id cust_id amount\n  9020      109     36.80\n  9022      105     28.22\n  9024      109     23.20\n  9025      103     47.00\n\nyou write a query to sum up which return the following results:\nselect SUM(amount) FROM orders; \u003e135.22\n\nwhat is the function used in this query called in sql\n\n\nwhat is primary character that makes a database releational?\n\u003e data stored in the datvase are of similar length\n\u003e users from accorss the org can acess the data in multiple tables\n\u003e data stored in the databse address a common subject\n\u003e keys join releted data accrooss multiple tables\n\n\nwhat is one of the primary advantages of postgresSql?\n\u003e it is developed by corp","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faakashdeveloper%2Frandominterview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faakashdeveloper%2Frandominterview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faakashdeveloper%2Frandominterview/lists"}