QuizzesTypeScript on the Server — Concept Check
intermediate
javascript

TypeScript on the Server — Concept Check

Questions on TypeScript on the Server. Node with TypeScript — module resolution, environment variables, and where a typed backend genuinely pays off in a full-stack app.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on TypeScript on the Server — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.You are setting up a Node.js project with TypeScript. Your package.json specifies "type": "module". What module system will your .js files use?

    • ACommonJS
    • BESM
    • CUMD
    • DAMD
  2. 2.A developer tries to import a TypeScript file using a relative path without an extension in a Node.js project configured with NodeNext. What will happen?

    • AThe import will succeed without any issues.
    • BThe import will fail because the output extension is required.
    • CThe import will succeed but with a warning.
    • DThe import will fail because TypeScript files cannot be imported directly.
  3. 3.You notice that your environment variable PORT is being used in arithmetic operations without validation. What could be a potential issue?

    • AThe operation will always throw an error.
    • BThe operation may result in unexpected string concatenation.
    • CThe operation will convert PORT to a boolean.
    • DThe operation will cause a runtime crash.
  4. 4.A developer changes a field name from 'slug' to 'id' in a shared TypeScript type. What is the immediate impact on the full-stack application?

    • AOnly the server will fail to compile.
    • BOnly the client will fail to compile.
    • CThe application will run but with runtime errors.
    • DBoth server and client will fail to compile.
  5. 5.Your Node.js application crashes on startup due to a missing JWT_SECRET. What is the likely cause?

    • AThe database connection failed.
    • BThe environment validation failed due to a missing required variable.
    • CThe application code is missing a try-catch block.
    • DThe JWT_SECRET is not being used in the code.
  6. 6.Why might a developer incorrectly believe that __dirname is available in ESM modules?

    • AThey read outdated documentation.
    • BThey configured TypeScript incorrectly.
    • CThey assume ESM and CommonJS have identical features.
    • DThey used a polyfill without realizing.
  7. 7.What is the purpose of using zod in environment configuration for a Node.js application?

    • ATo validate and coerce environment variables at startup.
    • BTo generate TypeScript types from environment variables.
    • CTo automatically encrypt environment variables.
    • DTo log environment variables securely.
  8. 8.A developer runs a TypeScript file using 'node src/index.ts' without any flags. What is a potential issue they might face?

    • AThe file will run but with incorrect type checking.
    • BThe file will run but with incorrect module resolution.
    • CThe file will run but with incorrect environment variables.
    • DThe TypeScript file won't run because Node doesn't natively support TypeScript.