Bird
Raised Fist0
Angularframework~20 mins

Angular CLI installation and setup - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Angular CLI Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Angular CLI Installation Command
Which command correctly installs the Angular CLI globally using npm?
Anpm install --global angular-cli
Bnpm install @angular/cli -g
Cnpm global install angular-cli
Dnpm install -g @angular/cli
Attempts:
2 left
💡 Hint
The global flag is -g.
❓ component_behavior
intermediate
2:00remaining
Angular CLI New Project Creation
What is the output behavior after running the command 'ng new my-app' in a terminal?
ACreates a new folder 'my-app' with Angular project files and installs dependencies
BOnly creates a folder 'my-app' without any files inside
CUpdates the existing Angular project in the current folder
DGenerates a new Angular component named 'my-app' inside the current project
Attempts:
2 left
💡 Hint
Think about what 'ng new' is designed to do.
📝 Syntax
advanced
2:00remaining
Correct Angular CLI Command to Serve Project
Which command correctly starts the Angular development server for the current project?
Ang build --serve
Bng serve
Cng run
Dng start
Attempts:
2 left
💡 Hint
The command to launch the dev server is short and simple.
🔧 Debug
advanced
2:00remaining
Error When Running 'ng' Command
You installed Angular CLI globally but running 'ng version' gives 'command not found'. What is the most likely cause?
AYou must run 'npm link @angular/cli' after installation
BAngular CLI was installed locally, not globally
CThe npm global bin folder is not in your system PATH environment variable
DYou need to restart your terminal after installation
Attempts:
2 left
💡 Hint
Check if your system knows where to find global npm commands.
❓ lifecycle
expert
2:00remaining
Angular CLI Version Compatibility
You have Angular CLI version 15 installed globally but your project uses Angular version 13. What is the expected behavior when running 'ng serve' inside the project folder?
AThe CLI will warn about version mismatch but still serve the project
BThe CLI will refuse to run and throw an error about incompatible versions
CThe CLI will automatically downgrade itself to version 13
DThe CLI will serve the project but with missing features from version 15
Attempts:
2 left
💡 Hint
Angular CLI tries to work with older projects but warns you.

Practice

(1/5)
1. What is the main purpose of the Angular CLI tool?
easy
A. To create and manage Angular projects easily
B. To write Angular component code manually
C. To deploy Angular apps to the server automatically
D. To replace the need for Node.js in Angular development

Solution

  1. Step 1: Understand Angular CLI role

    Angular CLI is a command-line tool that helps create and manage Angular projects quickly.
  2. Step 2: Compare options

    Only To create and manage Angular projects easily correctly describes this purpose. Writing code manually or deployment are not CLI's main roles.
  3. Final Answer:

    To create and manage Angular projects easily -> Option A
  4. Quick Check:

    Angular CLI = project creation and management [OK]
Hint: Angular CLI helps start projects fast [OK]
Common Mistakes:
  • Thinking CLI writes code for you
  • Confusing CLI with deployment tools
  • Assuming CLI replaces Node.js
2. Which command correctly installs Angular CLI globally using npm?
easy
A. npm install @angular/cli
B. npm install -g @angular/cli
C. ng install -g @angular/cli
D. npm global install angular-cli

Solution

  1. Step 1: Recall npm global install syntax

    The correct syntax to install a package globally is npm install -g package-name.
  2. Step 2: Match Angular CLI package name

    The official package name is @angular/cli, so the full command is npm install -g @angular/cli.
  3. Final Answer:

    npm install -g @angular/cli -> Option B
  4. Quick Check:

    Global install = npm install -g [OK]
Hint: Use npm install -g for global packages [OK]
Common Mistakes:
  • Omitting the -g flag for global install
  • Using ng install instead of npm install
  • Wrong package name or missing @angular prefix
3. After installing Angular CLI globally, what command creates a new Angular project named my-app?
medium
A. ng create my-app
B. npm new my-app
C. ng generate project my-app
D. ng new my-app

Solution

  1. Step 1: Identify Angular CLI command for new projects

    The Angular CLI uses ng new to create new projects.
  2. Step 2: Check command syntax

    The correct syntax is ng new project-name, so ng new my-app is correct.
  3. Final Answer:

    ng new my-app -> Option D
  4. Quick Check:

    New project = ng new [OK]
Hint: Use ng new to create projects [OK]
Common Mistakes:
  • Using ng create instead of ng new
  • Trying npm new which doesn't exist
  • Using ng generate project incorrectly
4. You run ng serve but get an error saying command not found. What is the most likely cause?
medium
A. Angular CLI is not installed globally
B. You forgot to create a new project first
C. You need to run npm start instead
D. Your Node.js version is too new

Solution

  1. Step 1: Understand ng serve command

    ng serve runs the Angular development server and requires Angular CLI installed globally or locally.
  2. Step 2: Analyze error cause

    If the command is not found, it usually means Angular CLI is not installed globally or not in PATH.
  3. Final Answer:

    Angular CLI is not installed globally -> Option A
  4. Quick Check:

    ng serve error = missing global CLI [OK]
Hint: Check if Angular CLI is installed globally [OK]
Common Mistakes:
  • Assuming npm start replaces ng serve
  • Ignoring CLI installation errors
  • Blaming Node.js version without checking CLI
5. You want to create a new Angular project with routing enabled and SCSS styling using Angular CLI. Which command should you run?
hard
A. ng create my-app --routing --style=scss
B. ng new my-app -routing -style=scss
C. ng new my-app --routing --style=scss
D. ng generate project my-app --routing --style=scss

Solution

  1. Step 1: Recall correct command for new project with options

    The Angular CLI uses ng new with flags like --routing and --style=scss to enable routing and SCSS styling.
  2. Step 2: Verify option syntax

    Options must use double dashes and equal sign for style. So ng new my-app --routing --style=scss is correct.
  3. Final Answer:

    ng new my-app --routing --style=scss -> Option C
  4. Quick Check:

    New project with routing and SCSS = ng new with flags [OK]
Hint: Use ng new with --routing and --style flags [OK]
Common Mistakes:
  • Using ng create instead of ng new
  • Using single dash for options
  • Wrong option syntax like -routing
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard