(Full Stack JavaScript) Linting Knowledge Assessment Q & S 2024, Exams of Programming Languages

(Full Stack JavaScript) Linting Knowledge Assessment Q & S 2024(Full Stack JavaScript) Linting Knowledge Assessment Q & S 2024(Full Stack JavaScript) Linting Knowledge Assessment Q & S 2024(Full Stack JavaScript) Linting Knowledge Assessment Q & S 2024(Full Stack JavaScript) Linting Knowledge Assessment Q & S 2024

Typology: Exams

2023/2024

Available from 07/05/2024

emilio-clemente-2
emilio-clemente-2 🇺🇸

2

(2)

356 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Full Stack JavaScript
Linting
Knowledge Assessment
Q & S
2024
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download (Full Stack JavaScript) Linting Knowledge Assessment Q & S 2024 and more Exams Programming Languages in PDF only on Docsity!

Full Stack JavaScript

Linting

Knowledge Assessment

Q & S

  1. What is the primary purpose of a linting tool in JavaScript development?
    • A) To optimize code performance
    • B) To find and fix potential errors and coding style issues
    • C) To compile the code into machine language
    • D) To manage library dependencies
    • Answer : B
    • Rationale : Linting tools primarily analyze the code to identify and fix potential errors and enforce coding style guidelines.
  2. Which of the following is not a popular JavaScript linting tool?
    • A) ESLint
    • B) JSHint
    • C) Prettier
    • D) Pep
    • Answer : D
    • Rationale : Pep8 is a coding style guide and checker for Python, not JavaScript.
  3. How do you disable a specific linting rule inline in your JavaScript code using ESLint?
    • A) / eslint-disable-line rule-name /
  • Rationale : The .eslintignore file specifies files and directories that ESLint should exclude from linting.

Fill-in-the-Blank Questions

  1. ESLint can be extended with custom _______ and plugins to enforce project-specific code standards.
  • Answer : rules
  • Rationale : Custom rules and plugins allow for flexible linting tailored to specific project requirements.
  1. A _______ condition is a special syntax comment that instructs the linter to apply or disable certain rules.
  • Answer : pragma
  • Rationale : Pragma conditions help manage linting rules directly within the code.
  1. _______ is a popular code formatter that can work alongside ESLint to ensure consistent code style.
  • Answer : Prettier
  • Rationale : Prettier is commonly used to standardize code format across a project.
  1. A common ESLint error relates to the use of _______ variables, which are declared but never used.
  • Answer : unused
  • Rationale : ESLint often flags variables declared but not used, which can indicate a mistake or code that needs to be cleaned up.
  1. In a CI/CD pipeline, _______ tests are often run immediately after linting to ensure code quality and functionality.
  • Answer : unit
  • Rationale : Unit tests check the functionality of individual components, complementing the code quality checks enforced by linting.

True/False Questions

  1. ESLint can only be used with JavaScript and cannot be configured for TypeScript projects.
  • Answer : False
  • Rationale : ESLint can be configured to support TypeScript projects using additional plugins and configurations.
  1. Prettier can automatically fix most code style issues without manual intervention.
  • Answer : True
  • Rationale : Prettier enforces consistent code style and can auto-format code based on predefined rules.
  • Answer : True
  • Rationale : Running ESLint as a pre-commit hook catches linting issues before code is committed.
  1. The default ESLint configuration file is named .eslintrc.
  • Answer : True
  • Rationale : The standard ESLint configuration file is .eslintrc.
  1. Linting tools can also provide suggestions for improving code performance.
  • Answer : False
  • Rationale : Linting tools focus on code quality and correctness, not on performance optimization.
  1. ESLint can be integrated into popular editors like Visual Studio Code to provide real-time feedback.
  • Answer : True
  • Rationale : Integrating ESLint into editors like Visual Studio Code offers real-time linting feedback directly within the development environment.
  1. Multiple Choice: What is the primary purpose of a linter in JavaScript development? a) To compile code b) To format code

c) To find and fix problems in code d) To optimize runtime performance

Answer: c) To find and fix problems in code

Rationale: A linter is used to identify and fix problems in code, such as syntax errors, bugs, stylistic errors, and suspicious constructs.

  1. True/False: Linters are only useful for beginner programmers.

Answer: False

Rationale: Linters are beneficial for programmers of all skill levels as they enforce coding standards and help in identifying potential errors early.

  1. Fill-in-the-Blank: The process of checking the source code for programmatic and stylistic errors is known as ________.

Answer: Linting

Rationale: Linting is the term used to describe the process of checking the source code for programmatic and stylistic errors.

  1. Multiple Choice: Which of the following is not a common feature of a linter? a) Syntax validation b) Code beautification c) Performance profiling d) Automated fixing of errors

Answer: c) Performance profiling

  1. True/False: Linters are a replacement for thorough testing and code reviews.

Answer: False

Rationale: Linters are a helpful tool in the development process but do not replace the need for thorough testing and peer code reviews, which can catch issues that linters cannot.

  1. Fill-in-the-Blank: ________ is a static code analysis tool used to flag programming errors, bugs, stylistic errors, and suspicious constructs in C code.

Answer: Lint

Rationale: The term "Lint" originally referred to a particular tool that flagged suspicious and non-portable constructs in C code.

  1. Multiple Choice: Which of the following is a benefit of using a linter? a) Shorter compile times b) Improved code readability and maintainability c) Increased memory usage d) Longer runtime execution

Answer: b) Improved code readability and maintainability

Rationale: Linters help improve code quality, making it more readable and maintainable by enforcing coding standards and identifying potential errors.

  1. True/False: Linters can enforce coding style guidelines.

Answer: True

Rationale: One of the key functions of linters is to enforce coding style guidelines, ensuring consistency across the codebase.

  1. Fill-in-the-Blank: The practice of using tools to analyze code for potential errors is known as ________ analysis.

Answer: Static

Rationale: Static analysis is the practice of analyzing code without executing it, which is what linters do.

  1. Multiple Choice: Which of the following is not typically enforced by a linter? a) Code complexity b) Naming conventions c) Data type enforcement d) Code documentation

Answer: c) Data type enforcement

Rationale: While some linters can check for type-related issues, strict data type enforcement is typically handled by the programming language itself or other type-checking tools.

  1. True/False: Linters are integrated into the JavaScript runtime environment.

Answer: False

Rationale: ESLint is a widely used linting tool in the JavaScript ecosystem, providing customizable linting rules. Multiple Choice: Which of the following is NOT a benefit of using linting in software development? A. Consistent code style B. Improved code quality C. Reduced development time D. Increased runtime performance

Correct Answer: D. Increased runtime performance

Rationale: Linting focuses on code quality and style, rather than directly impacting runtime performance. Fill-in-the-Blank: Linting rules are typically defined in a configuration file such as _.

Correct Answer: .eslintrc

Rationale: Configuration files like .eslintrc specify the linting rules to be enforced in a project. True/False: Linting errors always prevent code from executing.

Correct Answer: False

Rationale: Linting errors are warnings and suggestions to improve code quality, but they do not necessarily halt code execution. Multiple Choice: The purpose of linting in a development workflow is to: A. Automatically fix all code issues B. Enforce coding standards and best practices C. Increase the size of the codebase D. Speed up the compilation process

Correct Answer: B. Enforce coding standards and best practices

Rationale: Linting enforces coding standards to maintain code quality and readability. Fill-in-the-Blank: The tool used to run a linter against a codebase is called a _.

Correct Answer: Runner

Rationale: A runner is responsible for executing the linting process on a codebase. True/False: Linting is only applicable to JavaScript files.

Correct Answer: False

Rationale: Linting errors are objective and based on predefined rules and best practices. Multiple Choice: Which of the following is NOT a linting tool commonly used in JavaScript development? A. JSLint B. Prettier C. JSHint D. TypeScript

Correct Answer: D. TypeScript

Rationale: TypeScript is a superset of JavaScript, not a standalone linting tool. Fill-in-the-Blank: The linting process can be integrated into _ to automate code quality checks.

Correct Answer: Continuous Integration (CI)

Rationale: CI pipelines often include linting as part of automated code quality checks. True/False: Linting rules can be customized to suit specific project requirements.

Correct Answer: True

Rationale: Linting rules can be tailored to match project-specific coding standards and preferences.