Interview Quizz Logo

 
  • Home
  • About Us
  • Electronics
  • Computer Science
  • Physics
  • History
  • Contact Us
  • ☰
  1. Computer Science
  2. Programming Technologies
  3. ReScript Interview Question with Answer

ReScript Questions and Answers for Viva

Frequently asked questions and answers of ReScript in Programming Technologies of Computer Science to enhance your skills, knowledge on the selected topic. We have compiled the best ReScript Interview question and answer, trivia quiz, mcq questions, viva question, quizzes to prepare. Download ReScript FAQs in PDF form online for academic course, jobs preparations and for certification exams .

Intervew Quizz is an online portal with frequently asked interview, viva and trivia questions and answers on various subjects, topics of kids, school, engineering students, medical aspirants, business management academics and software professionals.




Interview Question and Answer of ReScript


Question-1. What is ReScript?

Answer-1: ReScript is a strongly typed, JavaScript-like language designed for building web applications efficiently.



Question-2. What was ReScript previously known as?

Answer-2: ReScript was formerly known as BuckleScript and was related to ReasonML.



Question-3. How does ReScript compare to JavaScript?

Answer-3: ReScript is statically typed, compiles to highly optimized JavaScript, and eliminates runtime type errors.



Question-4. What is the file extension for ReScript?

Answer-4: ReScript source files use the .res extension.



Question-5. How do you declare a variable in ReScript?

Answer-5: Use let, e.g., let x = 10;.



Question-6. Does ReScript support mutability?

Answer-6: By default, ReScript variables are immutable; for mutability, use ref.



Question-7. How do you define a function in ReScript?

Answer-7: Use let, e.g., let add = (a, b) => a + b;.



Question-8. How do you enforce types in ReScript?

Answer-8: ReScript has a strong type system that infers types automatically but allows explicit annotations.



Question-9. How do you define a type alias in ReScript?

Answer-9: Use type, e.g., type age = int;.



Question-10. How do you define a tuple in ReScript?

Answer-10: Use (value1, value2), e.g., let person = ("Alice", 25);.



Question-11. How do you access tuple elements?

Answer-11: Use pattern matching, e.g., let (name, age) = person;.



Question-12. What is pattern matching in ReScript?

Answer-12: Pattern matching is used to destructure and match values, e.g., `switch x {



Question-13. How do you define a list in ReScript?

Answer-13: Use [value1, value2], e.g., let numbers = [1, 2, 3];.



Question-14. How do you add an element to a list?

Answer-14: Use ::, e.g., let newList = 0 :: numbers;.



Question-15. How do you create an object in ReScript?

Answer-15: Use { key: value }, e.g., let user = { name: "Alice", age: 25 };.



Question-16. How do you access object properties in ReScript?

Answer-16: Use dot notation, e.g., user.name;.



Question-17. How do you define a record in ReScript?

Answer-17: Use type, e.g., type person = { name: string, age: int };.



Question-18. How do you create an instance of a record?

Answer-18: Use {}, e.g., let p: person = { name: "Alice", age: 25 };.



Question-19. How do you define a union type in ReScript?

Answer-19: Use `



Question-20. How do you handle a union type in ReScript?

Answer-20: Use switch, e.g., `switch shape {



Question-21. What is the @genType annotation?

Answer-21: It generates TypeScript or Flow bindings from ReScript.



Question-22. How do you interact with JavaScript in ReScript?

Answer-22: Use @bs.val for values and @bs.module for modules.



Question-23. How do you define an external JavaScript function in ReScript?

Answer-23: Use @bs.val, e.g., @bs.val external log: string => unit = "console.log";.



Question-24. How do you call a JavaScript function from ReScript?

Answer-24: Use Js.log("Hello"); after defining it as an external binding.



Question-25. How do you import a JavaScript module in ReScript?

Answer-25: Use @bs.module, e.g., @bs.module("fs") external readFile: (string, string) => string = "readFileSync";.



Question-26. How do you handle exceptions in ReScript?

Answer-26: Use try and catch, e.g., try { riskyFunction(); } catch { _ => "Error" };.



Question-27. How do you work with promises in ReScript?

Answer-27: Use Js.Promise.t, e.g., let p: Js.Promise.t = fetch("/api");.



Question-28. How do you handle a resolved promise in ReScript?

Answer-28: Use .then_, e.g., p->Js.Promise.then_(res => { Js.log(res); Js.Promise.resolve(); });.



Question-29. What is pipe (->) in ReScript?

Answer-29: It allows function chaining, e.g., data->process->output;.



Question-30. How do you install ReScript?

Answer-30: Use npm install -g rescript.



Question-31. How do you compile a ReScript project?

Answer-31: Run rescript build.



Question-32. How do you watch for changes while developing in ReScript?

Answer-32: Run rescript build -w.



Question-33. How do you create a ReScript React component?

Answer-33: Use [@react.component] let make = () =>

"Hello"
;.



Question-34. How do you handle props in a ReScript React component?

Answer-34: Define parameters, e.g., [@react.component] let make = (~name) =>

name
;.



Question-35. How do you define a reducer in ReScript React?

Answer-35: Use React.useReducer, e.g., let (state, dispatch) = React.useReducer(reducer, initialState);.



Question-36. How do you write a type-safe event handler in ReScript?

Answer-36: Use ReactEvent.Mouse.t, e.g., let handleClick = (event: ReactEvent.Mouse.t) => Js.log("Clicked");.



Question-37. What is the difference between let and let%private in ReScript?

Answer-37: let defines a public function, while let%private restricts it to the module.



Question-38. How do you import TypeScript/JavaScript types into ReScript?

Answer-38: Use @genType and external bindings.



Question-39. Can ReScript be used without Node.js?

Answer-39: No, it relies on the Node.js ecosystem for tooling.



Question-40. How do you declare an interface in ReScript?

Answer-40: Use objects and records with type definitions.



Question-41. How do you perform string interpolation in ReScript?

Answer-41: Use Js.String.concat, e.g., "Hello " ++ name;.



Question-42. What are ReScript?s main advantages over TypeScript?

Answer-42: Better type inference, faster compilation, and stronger safety guarantees.



Question-43. How do you create an alias for a type in ReScript?

Answer-43: Use type alias = existingType;.



Question-44. How do you check if an option value is Some or None?

Answer-44: Use switch, e.g., `switch myValue {



Question-45. How do you use the Option type in ReScript?

Answer-45: Use Some(value) or None.



Question-46. What are the built-in modules in ReScript?

Answer-46: Modules like Js, Array, List, and String.



Question-47. How do you use ReScript with GraphQL?

Answer-47: Use the rescript-graphql package.



Question-48. How do you configure the ReScript compiler?

Answer-48: Modify bsconfig.json.



Question-49. What is the purpose of bs-platform?

Answer-49: It provides the ReScript compiler and runtime libraries.



Question-50. Where can you learn more about ReScript?

Answer-50: Visit the official site: https://rescript-lang.org.




Tags

Frequently Asked Question and Answer on ReScript

ReScript Interview Questions and Answers in PDF form Online

ReScript Questions with Answers

ReScript Trivia MCQ Quiz

FAQ Questions Sidebar

Related Topics


  • API Testing
  • Python
  • AWS Amazon Web Services
  • Java
  • C++
  • JavaScript
  • C#
  • PHP
  • Swift
  • Ruby
  • Kotlin
  • TypeScript
  • Go Golang
  • Rust
  • SQL
  • R
  • MATLAB
  • Perl
  • Scala
  • Dart
  • Haskell
  • Objective-C
  • Shell Scripting Bash
  • Visual Basic VB
  • Lua
  • Groovy
  • F#
  • Julia
  • COBOL
  • Fortran
  • Assembly Language
  • PL/SQL
  • Scratch
  • D
  • Erlang
  • Elixir
  • Clojure
  • Pascal
  • Ada
  • Lisp Common Lisp, Scheme
  • Prolog
  • Apex Salesforce
  • ActionScript
  • ABAP SAP
  • Racket
  • Nim
  • Crystal
  • Smalltalk
  • VHDL
  • Verilog
  • SASS Syntactically Awesome Style Sheets
  • Less CSS Preprocessor
  • CoffeeScript
  • J Sharp
  • Tcl (Tool Command Language)
  • XQuery
  • XSLT
  • OpenCL
  • CUDA
  • OpenGL Shader Language (GLSL)
  • VBScript
  • Solidity (Blockchain/Smart Contracts)
  • Yaml
  • JSON
  • XML
  • GDScript (Godot Engine)
  • UnrealScript (Unreal Engine)
  • Maple
  • Mathematica
  • Max/MSP
  • AutoLISP
  • LabVIEW
  • ScratchJr
  • AWK
  • sed (Stream Editor)
  • PostScript
  • Xojo
  • Q Sharp
  • Ring
  • ActionScript 3
  • OpenEdge ABL
  • RPG (IBM)
  • Inform
  • Modula-3
  • Rebol
  • Tcl/Tk
  • Haxe
  • SML (Standard ML)
  • Eiffel
  • Chapel
  • Red
  • MUMPS
  • PASCAL ABC
  • Icon
  • BCPL
  • Simula
  • SNOBOL
  • Hack (Meta)
  • PowerShell
  • Batch Script
  • AppleScript
  • Glue
  • Oz
  • Io
  • Mercury
  • Wren
  • Genie
  • PureScript
  • MoonScript
  • Turing
  • ALGOL
  • Seed7
  • Kotlin Native
  • Kotlin Multiplatform
  • Elm
  • PureBasic
  • QB64 (QuickBASIC)
  • Nemerle
  • Ocaml
  • Alloy
  • Cobra
  • Forth
  • Ballerina
  • Deno (JavaScript Runtime)
  • WASM (WebAssembly)
  • Z shell (Zsh)
  • Fish Shell
  • Redscript
  • Felix
  • ReScript
  • Agda
  • Idris
  • Coq
  • SPARK
  • Vala
  • PicoLisp
  • Wolfram Language
  • BASH (Bourne Again Shell)
  • Hy (Lisp-like for Python)
  • Terra
  • Boo
  • ATS
  • K (Kdb+)
  • Picat
  • Nimrod
  • Pawn
  • Papyrus (Bethesda Games)
  • J Programming Language
  • X++
  • MQL4/MQL5 (MetaTrader)
  • Transact-SQL (T-SQL)
  • BASH Shell Scripting

More Subjects


  • Computer Fundamentals
  • Data Structure
  • Programming Technologies
  • Software Engineering
  • Artificial Intelligence and Machine Learning
  • Cloud Computing

All Categories


  • Physics
  • Electronics Engineering
  • Electrical Engineering
  • General Knowledge
  • NCERT CBSE
  • Kids
  • History
  • Industry
  • World
  • Computer Science
  • Chemistry

Can't Find Your Question?

If you cannot find a question and answer in the knowledge base, then we request you to share details of your queries to us Suggest a Question for further help and we will add it shortly in our education database.
© 2025 Copyright InterviewQuizz. Developed by Techgadgetpro.com
Privacy Policy