Skip to content

Instantly share code, notes, and snippets.

@akashraj9828
Last active August 4, 2023 09:41
Show Gist options
  • Save akashraj9828/c635ce377c8200d02981a6e10e01e99d to your computer and use it in GitHub Desktop.
Save akashraj9828/c635ce377c8200d02981a6e10e01e99d to your computer and use it in GitHub Desktop.

Revisions

  1. akashraj9828 revised this gist Aug 4, 2023. No changes.
  2. akashraj9828 revised this gist Jul 31, 2023. No changes.
  3. akashraj9828 revised this gist Aug 22, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion question.md
    Original file line number Diff line number Diff line change
    @@ -68,8 +68,8 @@ A *smart* api is available at your disposal details of which are also mentioned

    ### How would you build this?
    1. How would you design the component tree for this application?
    ```jsx
    ** **Sample unrelated component tree:** **
    ```jsx
    - <App/>
    - <ToDoList/>
    - <Todo/>
  4. akashraj9828 revised this gist Aug 22, 2022. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions question.md
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,7 @@ A *smart* api is available at your disposal details of which are also mentioned

    ### How would you build this?
    1. How would you design the component tree for this application?

    ```jsx
    ** **Sample unrelated component tree:** **
    - <App/>
    - <ToDoList/>
    @@ -77,6 +77,7 @@ A *smart* api is available at your disposal details of which are also mentioned
    - <TodoName/>
    - <RemoveIcon/>
    - <MarkAllDone/>
    ```
    3. How do you manage state?
    4. What all do you store in the state?

    @@ -93,12 +94,13 @@ A *smart* api is available at your disposal details of which are also mentioned
    }
    ```
    5. How do you use useEffect, useState or any other method to handle and states and events/callbacks in the application.

    ```
    ** **Sample unrelated answer:** **
    - Use effect to load the tasks from the api
    - Use state to update the task list
    - Callback to add new task
    - Callback to update a task
    - Callback to remove a task
    - Callback to order the task list
    - Callback to mark all the task as done
    - Callback to mark all the task as done
    ```
  5. akashraj9828 revised this gist Aug 22, 2022. 1 changed file with 11 additions and 14 deletions.
    25 changes: 11 additions & 14 deletions question.md
    Original file line number Diff line number Diff line change
    @@ -20,18 +20,17 @@ A *smart* api is available at your disposal details of which are also mentioned
    - As a recruiter, I want the user to answer only one question at a time.
    - As a recruiter, I want the time limit to be enforced for each question.
    - As a recruiter, when a question times out, I want the answer to be submitted anyway.
    - As a user if I reload the page/ open the quiz in a new tab,
    I want to be able to continue with the answer that I had written/selected before the reload.
    - As a user if I restart the app, I want to be able to continue with the answer that I had written/selected before the restart.
    - As a user, I would like to see a finish message when the quiz is over.


    ### Acceptance Criteria:
    - The question is displayed.
    - Answer input is displayed.
    - A timer is displayed.
    - On reload, the timer should be restored.
    - On reload, the application should the answer be repopulated.
    - On reload, the application should start from where the user left off.
    - On restart, the timer should be restored.
    - On restart, the application should the answer be repopulated.
    - On restart, the application should start from where the user left off.
    - The user doesn't exceed the time limit for the question.


    @@ -71,15 +70,13 @@ A *smart* api is available at your disposal details of which are also mentioned
    1. How would you design the component tree for this application?

    ** **Sample unrelated component tree:** **
    - App
    - ToDo List
    - Todo
    - Drag Handle
    - Checkbox
    - Todo type
    - Todo name
    - Remove
    - Mark all as done
    - <App/>
    - <ToDoList/>
    - <Todo/>
    - <Checkbox/>
    - <TodoName/>
    - <RemoveIcon/>
    - <MarkAllDone/>
    3. How do you manage state?
    4. What all do you store in the state?

  6. akashraj9828 created this gist Jul 15, 2022.
    107 changes: 107 additions & 0 deletions question.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,107 @@



    # Technical discussion
    *Questions are welcome.*


    ### Problem statement:
    An IT company wants to screen the candidates that come through for the interview process.
    The company would like the application flexible and allow candidates from various domains are able to take a test.
    As a developer, your task is to create a react quiz application that:
    1. Takes user inputs of different types for timed question
    1. Submits the answers using the available API be stored to a backend database.

    A *smart* api is available at your disposal details of which are also mentioned below.



    ### User story:
    - As a recruiter, I want the user to answer only one question at a time.
    - As a recruiter, I want the time limit to be enforced for each question.
    - As a recruiter, when a question times out, I want the answer to be submitted anyway.
    - As a user if I reload the page/ open the quiz in a new tab,
    I want to be able to continue with the answer that I had written/selected before the reload.
    - As a user, I would like to see a finish message when the quiz is over.


    ### Acceptance Criteria:
    - The question is displayed.
    - Answer input is displayed.
    - A timer is displayed.
    - On reload, the timer should be restored.
    - On reload, the application should the answer be repopulated.
    - On reload, the application should start from where the user left off.
    - The user doesn't exceed the time limit for the question.



    ### Available Backend API:
    - The following backend endpoints for the UI to consume:
    1. Gets all question ids;
    The questions that are already answered will not be available in the api
    - Returns String[] // Array of ids of question
    2. Gets a question by id; has all the information to render the question
    ``` ts
    // Returns
    {
    time_limit_in_seconds: Number,
    question_type: "text" | "multiple_choice" | "code" | "multiple_select",
    options?: String[], // available only for "multiple_choice" | "multiple_select" questions
    question: String, // The question text string to be rendered.
    hints?: String, // An optional multiline help text string.
    }
    ```
    3. Submit one answer by id

    ``` ts
    // Request body
    {
    question_id: String
    answer: any
    }
    // Returns - HTTP success/failure
    ```





    ### How would you build this?
    1. How would you design the component tree for this application?

    ** **Sample unrelated component tree:** **
    - App
    - ToDo List
    - Todo
    - Drag Handle
    - Checkbox
    - Todo type
    - Todo name
    - Remove
    - Mark all as done
    3. How do you manage state?
    4. What all do you store in the state?

    ** **Sample unrelated state:** **
    ```ts
    {
    tasks: [{
    created_at: Date
    order: Number
    isDone: Boolean
    title: String
    type: "checklist" | "notes"
    }]
    }
    ```
    5. How do you use useEffect, useState or any other method to handle and states and events/callbacks in the application.

    ** **Sample unrelated answer:** **
    - Use effect to load the tasks from the api
    - Use state to update the task list
    - Callback to add new task
    - Callback to update a task
    - Callback to remove a task
    - Callback to order the task list
    - Callback to mark all the task as done