Question: Cepheid Coding Questions Jan 30th | Array Traversal & Angular Framework Concepts | Recent Online Assessment 2026 | Peak Output Coding & Angular MCQs
1
Entering edit mode

 Section 1: Coding Question

Question: Peak Output

Problem Statement:

The workload of an employee is the number of hours the employee works in a day. Given the workload of an employee over N working days (workload), compute the Peak output for the employee.

Peak Output is the maximum number of consecutive working days when the employee has worked for more than 6 hours.

Function Description:

Complete the solve() function. This function takes the following 2 arguments and returns the peak output.

Parameters:

  • N: Represents the number of working days.
  • workload: Represents workload[i] denoting the number of hours an employee worked on an i^{th} day.

Input Format:

  • The first line contains an integer N denoting the number of working days.
  • The second line contains a space-separated integer array workload where workload[i] represents the number of hours an employee worked on the i^{th} day.

 


Section 2: Angular Framework MCQs

Question 1: Angular Elements

Alice is creating an Angular application and wants to convert some of the components to web components so that they can be used in non-Angular applications. Which of the following statements are true about Angular Elements?

Statements:

  1. Angular Elements allow you to package Angular components as web components.
  2. Angular Elements are similar to Custom Elements but have some additional capabilities.
  3. To create an Angular Element, you need to use the "@angular/elements" package and register the component as a custom element.
  4. Angular Elements work in all modern browsers, including Internet Explorer.

Options:

  • 1, 2, and 3
  • 2, 3, and 4
  • 1, 3, and 4
  • 1, 2, and 4

Question 2: Angular Services

What decorator is used to mark a class as an Angular service?

Options:

  • @Service
  • @Injectable
  • @Component
  • @Provider

Question 3: Angular Router Lifecycle

Which of the following is the correct order of steps that are followed by an Angular router after reading the browser URL and applying a URL redirect?

Steps:

  1. It activates Angular components to display the page.
  2. It runs the guards that are defined in the router state.
  3. It resolves the required data for the router state.
  4. It figures out which router state corresponds to the URL.
  5. It manages navigation and repeats the steps when a new page is requested.

Options:

  • 2, 4, 3, 1, and 5
  • 4, 2, 3, 1, and 5
  • 4, 3, 1, 2, and 5
  • 2, 1, 4, 3, and 5

Question 4: Attribute Binding

Anita is developing an Angular application and wants to apply conditional logic based on the value of an attribute of an HTML element. Which of the following statements is/are true about attribute binding in Angular?

Statements:

  1. Attribute binding is used to set the value of an attribute of an HTML element.
  2. Attribute binding is two-way only, which means changes to the attribute value in the HTML element will also update the component's property.
  3. The square brackets syntax is used for attribute binding in Angular.
  4. Attribute binding can be used to apply conditional logic based on the value of an attribute.

Options:

  • 1, 2, and 3
  • 2, 3, and 4
  • 1, 2, and 4
  • 1, 3, and 4

Question 5: Debugging Angular Logic

Code: HTML

<button (click)="changeColor()">Change Color</button>

Code: TypeScript (Angular)

TypeScript

changeColor() {

    this.backgroundColor = 'red';

}

Problem Statement:

However, the above code does not seem to work as expected. She wants your help in identifying the issue. Which of the following options could be the reason why the code is not working as expected?

Options:

  1. The button element is not included in the component template
  2. The backgroundColor variable is not defined in the component
  3. The changeColor() method is not called on button click
  4. The component template does not have the property binding to update the background color

Option Sets:

  • 1 and 2
  • 3 and 4
  • 1 and 3
  • 2 and 4
ADD COMMENTlink 6 hours ago admin 1.8k

Login before adding your answer.

Similar Posts
Loading Similar Posts