Thursday, February 29, 2024

Interview questions for Angular dev

Basic FrontEnd

html

localstorage, sessionstorage, cookie

web components

shadow dom

accessibility

Which code sets the colspan attribute on the td element?

css/scss

box model

pseudo element

positions: static, absolute...

layouts: flex, grid

selectors: tag, id, class... specificity

scss: var, func, nesting

mobile first


js/ts

data types: number, string, null, undefined

ts type: unknown, any

scope: global/function/block

closure

prototype

array: map, filter, reduce, some, push, concat...

operators: ??, ||

arrow function vs. normal function, what's "this" value

async function: why js is single thread but can process async events


const obj = { a: "one", b: "two", a: "three" }; console.log(obj)

viết hàm async tính giai thừa của n (n >= 0)


Angular


Basic

how many years of exprience

Angular overall architecture

Angular directive (structive, attribute) 

directive vs. component

life cycle hooks

how 2 components communicate

syntax to lazy-load a module

UI library: primeNg, material

What is the syntax for a template reference variable?


Advanced

How a component get data from main app

change detection: onPush vs. Default

What is the default value of 'ViewEncapsulation'?

role of interceptor

type of valuechanges in formcontrol

selector used to style a component based on a condition outside of the view

when impure pipe run

How can you have a separate instance of service "MyMockService" in every instance of a component?

At what lifecycle hook will ViewChild query be accessible? @ViewChild(foo', (static: false}) foo: ElementRef

What is differential loading?

How can you specify an alternative class provider?

control value accessor

tại sao data trong 1 service không bị mất khi chuyển trang

làm thế nào để ng-content select đúng template

dùng gì để provide data cho một page trc khi chuyển đến

state management

ngrx

how it works

Example

Which syntax completes the following code so that it displays 

'Hello Angular!', given that isTrue = false; ?           <span>Hello

<span …›world</span></span><ng-template #hi>Angular</ng-template>


How many times will console.log be called in the following example? import {of} from 'rxjs';   of([2,3,41).subscribe({next: n => console.log(n)})

rxjs

các rxjs operator hay dùng

switchMap vs. exhaustMap, nếu có error thì có chạy tiếp k

forkJoin vs. combineLatest

Observable vs. promise

rxjs map vs. switchMap

Testing

unit test vs. e2e test

cypress, mocha...

TDD

clean code

SOLID

how to refactor code


design pattern

DI, Facade,...


code review

coding style

communicate BE vs FE


Debug 

- chrome dev tools

- angular dev tools

- redux


GIT

git flow

merge vs. rebase


BE

SQL schema

Restful (http verbs, put vs. patch)

PSR

Optimization

Debug

SQL index: btree, hash


others

 Describe your project architecture

Monday, February 5, 2024

First test in new year

 I've just taken a test provided by Hackerrank, to apply for a FE senior position in Positive Thinking Company.

The test contained 5 single-choice questions and 2 coding challenges.

I quickly moved over the first 5 questions, then stucked on the 6th one which is an algorithm coding exercise. 

The question asked to get the maximum value of ratings array if we cannot skip 2 concecutive numbers (can skip one then must take the next one). In this case we need to have 

Example:

input:

[-1, -2, -3, -4, -5]

output:

-6

explanation:

take [-2, -4] and skip others to have maximal number of -6

The last question was about moving data among parttitions in a hard disk to store data in the least partitions possible.

Example:

input:

- used: [3, 2, 1, 3, 1]

- total capacity: [3, 5, 3, 5, 5]

output:

2

explanation:

move first partition to second partition, move third and last partitions to 4th partition, then we have result of [0, 5, 0, 5, 0] which stores in 2 partitions.

I had feedback right away: FAILED :(

40% (need 50% to be mid and 60% to be senior)


I need to practice more algorithm then.

Thursday, March 30, 2023

Second interview with Niteco

Focus mostly on: SEO, Optimization (which I have very modest idea on sadly)

how to do SEO for Angular

what to consider while optimizing a page

design pattern: which ones you applied in your angular app

image: multiple images in one vector,  load priority

css: mixins, avoid duplicate (css~where), remove unused css

UI: style guide, how to compare styles in different versions

lazyload component

webpack: bundle split

3th party libs: how to make sure they don't affect current page

cdn: make it fast

API call: how to add header