Home »
MCQs
Jupyter MCQs (Multiple-Choice Questions)
Jupyter is an open-source ecosystem for interactive computing that allows users to create and share documents containing live code, output, visualizations, equations, and explanatory text. Jupyter Notebook and JupyterLab support interactive programming through kernels and provide tools for data analysis, scientific computing, education, and research.
Jupyter MCQs
These Jupyter MCQs cover important concepts related to Jupyter Notebook, JupyterLab, kernels, notebook cells, the .ipynb format, Markdown, code execution, magic commands, Jupyter Server, and notebook conversion.
List of Jupyter MCQs
The following Jupyter multiple-choice questions are useful for students, programmers, data science learners, and candidates preparing for technical examinations and interviews.
1. What is Jupyter primarily used for?
- Interactive computing and creating computational documents
- Managing relational databases only
- Building operating systems
- Creating device drivers
Answer: A) Interactive computing and creating computational documents
Explanation:
Jupyter provides an interactive computing environment where users can combine code, output, visualizations, mathematical expressions, and explanatory text in notebooks.
2. What file extension is commonly used for Jupyter Notebook documents?
.py
.ipynb
.jupyter
.nbpy
Answer: B) .ipynb
Explanation:
Jupyter Notebook documents are stored using the .ipynb extension and use a JSON-based notebook format.
3. What does the "nb" in .ipynb commonly represent?
- Network binary
- Notebook
- New browser
- Numeric buffer
Answer: B) Notebook
Explanation:
The .ipynb extension identifies a Jupyter notebook document.
4. Which technology is used to structure the contents of a Jupyter Notebook file?
- XML
- JSON
- CSV
- INI
Answer: B) JSON
Explanation:
Jupyter notebooks are stored as structured JSON documents containing information such as cells, metadata, source code, and outputs.
5. What is a kernel in the Jupyter ecosystem?
- A process that runs code for a particular programming language
- A file compression utility
- A database engine
- A web browser extension
Answer: A) A process that runs code for a particular programming language
Explanation:
A Jupyter kernel is a language-specific process that executes code sent to it by a Jupyter application and returns results.
6. Which kernel is commonly used to execute Python code in Jupyter?
- CPythonKernel
- IPython kernel, provided through
ipykernel
- PythonServer
- PyKernelServer
Answer: B) IPython kernel, provided through ipykernel
Explanation:
ipykernel provides the reference Jupyter kernel for Python and is built on IPython.
7. Which statement about Jupyter kernels is correct?
- Jupyter supports only Python kernels
- Jupyter can work with kernels for multiple programming languages
- Every notebook must use the same kernel
- Kernels are used only for displaying Markdown
Answer: B) Jupyter can work with kernels for multiple programming languages
Explanation:
Jupyter supports many programming languages through language-specific kernels. Python, R, Julia, and many other languages can be used with appropriate kernels.
8. What happens to variables created in a running Jupyter kernel?
- They are immediately deleted after every cell
- They remain available to subsequent cells in the same kernel session
- They are stored only in the browser cache
- They are converted into Markdown
Answer: B) They remain available to subsequent cells in the same kernel session
Explanation:
The kernel is a long-running process. Variables and objects created during execution remain available while that kernel session continues running.
9. Which type of cell is normally used to execute programming code in a Jupyter Notebook?
- Code cell
- Text cell
- HTML-only cell
- Output cell
Answer: A) Code cell
Explanation:
A code cell contains source code that can be sent to the active kernel for execution.
10. Which cell type is commonly used for explanatory text and formatted documentation?
- Code
- Markdown
- Kernel
- Output
Answer: B) Markdown
Explanation:
Markdown cells allow users to write formatted text, headings, lists, links, equations, and other explanatory content.
11. What is the purpose of executing a code cell?
- To send its code to the active kernel for execution
- To convert it automatically to HTML
- To permanently delete the cell
- To rename the notebook
Answer: A) To send its code to the active kernel for execution
Explanation:
When a code cell is executed, its source code is sent to the associated kernel, which processes it and returns output or an error.
12. What does the output of a Jupyter code cell represent?
- Only the source code
- The result produced by executing the cell
- The notebook filename
- The kernel configuration file
Answer: B) The result produced by executing the cell
Explanation:
A code cell can produce output such as text, numbers, tables, images, plots, or error information.
13. Which keyboard shortcut is commonly used to execute the current cell and move to the next cell in Jupyter Notebook?
- Shift + Enter
- Ctrl + S
- Alt + Enter
- Ctrl + Z
Answer: A) Shift + Enter
Explanation:
In the classic Jupyter Notebook interface, Shift + Enter executes the current cell and selects the next cell.
14. Which keyboard shortcut is commonly used to execute the current cell and insert a new cell below it?
- Shift + Enter
- Alt + Enter
- Ctrl + Enter
- Esc + Enter
Answer: B) Alt + Enter
Explanation:
Alt + Enter executes the current cell and creates a new cell below it in the classic notebook interface.
15. What does Ctrl + Enter commonly do to the selected cell in Jupyter Notebook?
- Deletes the cell
- Executes the cell without moving to another cell
- Converts the cell to Markdown
- Restarts the kernel
Answer: B) Executes the cell without moving to another cell
Explanation:
Ctrl + Enter executes the currently selected cell while keeping the selection on that cell.
16. Which cell type should be selected to write Markdown-formatted documentation?
- Code
- Markdown
- Raw
- Output
Answer: B) Markdown
Explanation:
Markdown cells are designed for formatted text and documentation inside a notebook.
17. What happens when a Markdown cell is rendered?
- It is sent to the Python kernel as Python code
- Its Markdown content is displayed as formatted text
- It is converted into a database table
- It is deleted
Answer: B) Its Markdown content is displayed as formatted text
Explanation:
Markdown syntax is interpreted and displayed as formatted content when the Markdown cell is rendered.
18. Which language is commonly used to format text in Jupyter Markdown cells?
- Markdown
- SQL
- Assembly
- CSS only
Answer: A) Markdown
Explanation:
Jupyter notebooks use Markdown cells for structured and formatted explanatory text.
19. Which of the following can be included in a Jupyter Notebook?
- Code
- Formatted text
- Visualizations
- All of the above
Answer: D) All of the above
Explanation:
A notebook can combine executable code, explanatory text, mathematical expressions, multimedia, and visual output in one document.
20. Which component acts as a communication hub between the browser, notebook, and kernel?
- Jupyter Server
- Python interpreter only
- Markdown renderer
- Notebook cell
Answer: A) Jupyter Server
Explanation:
The Jupyter Server facilitates communication between the browser-based interface, notebook documents, and kernels.
21. Which component is responsible for saving and loading notebook files in the Jupyter architecture?
- The kernel
- The Jupyter Server
- The Python variable
- The Markdown parser
Answer: B) The Jupyter Server
Explanation:
The Jupyter Server handles notebook file operations. The kernel is responsible for executing code rather than saving the notebook document.
22. What does the Jupyter kernel primarily do?
- Execute code sent to it
- Save notebook files to disk
- Manage browser tabs
- Convert all Markdown to PDF
Answer: A) Execute code sent to it
Explanation:
The kernel receives code from the Jupyter application, executes it, and sends results back to the application.
23. What happens when a Jupyter kernel is shut down?
- Variables held only in that kernel session are lost
- The notebook automatically becomes a PDF
- The
.ipynb file is converted to Python
- All Markdown cells are deleted
Answer: A) Variables held only in that kernel session are lost
Explanation:
Variables and objects stored in the running kernel exist in memory. Shutting down the kernel removes that runtime state, although the saved notebook file remains on disk.
24. Which statement about a Jupyter Notebook file is correct?
- It stores only Python source code
- It can store code, metadata, content, and outputs
- It can store only images
- It is always a binary executable
Answer: B) It can store code, metadata, content, and outputs
Explanation:
The notebook format stores cells, source code, outputs, metadata, and other document information.
25. Which library provides functionality for working with the Jupyter notebook format?
- nbformat
- requests
- numpy
- tkinter
Answer: A) nbformat
Explanation:
The nbformat library provides functionality for reading, writing, and working with Jupyter notebook documents.
26. What are Jupyter magic commands primarily associated with?
- IPython features available in interactive environments
- Operating system boot processes
- Database encryption
- HTML validation only
Answer: A) IPython features available in interactive environments
Explanation:
IPython provides special commands known as magic commands that can be used within Jupyter notebooks.
27. Which prefix identifies a line magic command in IPython?
%
#
@
$
Answer: A) %
Explanation:
IPython line magic commands generally begin with a single percent sign, such as %time.
28. Which prefix is commonly used for a cell magic command?
%%
##
@@
$$
Answer: A) %%
Explanation:
Cell magic commands use two percent signs at the beginning of a cell, such as %%time.
29. What does %time generally help measure?
- Execution time of a single statement
- Notebook file size
- Available disk space
- Kernel memory address
Answer: A) Execution time of a single statement
Explanation:
The %time magic can be used to measure the execution time of a statement.
30. What does %%time generally measure?
- The execution time of an entire cell
- The notebook creation date
- The kernel installation time
- The time required to save an image
Answer: A) The execution time of an entire cell
Explanation:
%%time is a cell magic that measures the execution time of the code in the cell.
31. Which magic command can be used to display the current working directory in IPython?
%pwd
%directory
%cwdpath
%where
Answer: A) %pwd
Explanation:
The %pwd magic displays the current working directory in an IPython environment.
32. Which magic command can be used to change the current working directory?
%cd
%cwd
%change
%directory
Answer: A) %cd
Explanation:
The %cd magic changes the current working directory in IPython.
33. What is JupyterLab?
- An extensible Jupyter user interface
- A Python compiler only
- A database server
- A replacement for the Python language
Answer: A) An extensible Jupyter user interface
Explanation:
JupyterLab provides a flexible user interface for working with notebooks, code, terminals, files, and other interactive computing tools.
34. Which feature is associated with JupyterLab?
- Multiple documents and activities can be arranged within one interface
- It can execute only Java code
- It cannot open notebooks
- It works only as a text editor
Answer: A) Multiple documents and activities can be arranged within one interface
Explanation:
JupyterLab provides a flexible workspace where notebooks, text files, terminals, and other components can be arranged and used together.
35. Which of the following is a valid use of Jupyter Notebook?
- Data analysis
- Scientific computing
- Education and demonstrations
- All of the above
Answer: D) All of the above
Explanation:
Jupyter is widely used for data analysis, scientific computing, education, research, visualization, and interactive programming.
36. Which tool is commonly used to convert Jupyter notebooks to other formats?
- nbconvert
- nbviewer
- ipykernel
- jupyter-kernel
Answer: A) nbconvert
Explanation:
nbconvert converts Jupyter notebook documents into formats such as HTML, PDF, Markdown, LaTeX, and scripts.
37. Which command converts a notebook to HTML using nbconvert?
jupyter nbconvert --to html notebook.ipynb
jupyter html notebook.ipynb
jupyter convert --html notebook.ipynb
nbconvert html notebook.ipynb
Answer: A) jupyter nbconvert --to html notebook.ipynb
Explanation:
The --to option specifies the target format for the notebook conversion.
38. Which command can convert a notebook to a Python script?
jupyter nbconvert --to script notebook.ipynb
jupyter notebook --script notebook.ipynb
jupyter export --python notebook.ipynb
jupyter script --from notebook.ipynb
Answer: A) jupyter nbconvert --to script notebook.ipynb
Explanation:
The script exporter can convert a notebook into an executable script appropriate for the notebook's kernel language.
39. Which of the following is a supported nbconvert output format?
- HTML
- Markdown
- LaTeX
- All of the above
Answer: D) All of the above
Explanation:
nbconvert supports several output formats, including HTML, Markdown, LaTeX, PDF, reStructuredText, scripts, and notebook formats.
40. Which option is used with nbconvert to specify the output format?
--to
--format-only
--output-type
--convert-format
Answer: A) --to
Explanation:
The --to argument specifies the exporter or target format used by nbconvert.
41. Which command can execute a notebook and save the result as a notebook?
jupyter nbconvert --to notebook --execute notebook.ipynb
jupyter notebook --run notebook.ipynb
jupyter execute --save notebook.ipynb
jupyter nbformat --run notebook.ipynb
Answer: A) jupyter nbconvert --to notebook --execute notebook.ipynb
Explanation:
nbconvert can execute the notebook using the --execute option and save the resulting notebook document.
42. What is the purpose of the --allow-errors option when executing notebooks with nbconvert?
- It allows conversion to continue even when cell execution produces errors
- It removes all errors from Python code
- It disables the kernel
- It converts errors into Markdown
Answer: A) It allows conversion to continue even when cell execution produces errors
Explanation:
When used with notebook execution, --allow-errors allows the process to continue after an exception rather than aborting at the first error.
43. Which Jupyter component provides the Python kernel implementation?
- ipykernel
- nbconvert
- nbformat
- jupyter-server-proxy
Answer: A) ipykernel
Explanation:
ipykernel provides the IPython kernel used to execute Python code in Jupyter applications.
44. Which statement about a Jupyter kernel is correct?
- The kernel must know how the notebook document is formatted
- The kernel receives code cells and executes them
- The kernel is responsible for rendering every Markdown heading
- The kernel stores the notebook file on disk
Answer: B) The kernel receives code cells and executes them
Explanation:
The kernel focuses on code execution and maintains the runtime state. Notebook file management and communication are handled by the Jupyter application and server components.
45. Which of the following can be used as a Jupyter kernel language besides Python?
- R
- Julia
- Other supported languages through their kernels
- All of the above
Answer: D) All of the above
Explanation:
Jupyter is language-agnostic at the kernel level. Additional kernels allow notebooks to work with languages such as R, Julia, and many others.
46. What is required to run code written in a language other than Python in Jupyter?
- An appropriate kernel for that language
- A new
.ipynb extension
- A different browser
- A separate Markdown parser
Answer: A) An appropriate kernel for that language
Explanation:
Jupyter applications can work with different programming languages when the corresponding language kernel is installed and available.
47. Which component allows Jupyter applications to communicate with kernels using the Jupyter messaging protocol?
- jupyter-client
- nbconvert
- Markdown
- Matplotlib
Answer: A) jupyter-client
Explanation:
jupyter-client provides the client-side functionality and contains the authoritative description of the Jupyter messaging protocol used for communication with kernels.
48. Which statement best describes the relationship between a notebook and its kernel?
- The notebook is the document, while the kernel provides the runtime for executing code
- The notebook and kernel are exactly the same component
- The kernel stores only Markdown content
- The notebook can execute code without any kernel
Answer: A) The notebook is the document, while the kernel provides the runtime for executing code
Explanation:
The notebook stores cells and document information, while the associated kernel executes code and maintains the runtime state.
49. Which feature makes Jupyter notebooks useful for documenting data analysis?
- They can combine executable code, results, visualizations, and explanatory text
- They allow only source code
- They automatically replace databases
- They can contain only plain text
Answer: A) They can combine executable code, results, visualizations, and explanatory text
Explanation:
A notebook combines computational and explanatory content in a single document, making it useful for analysis, experimentation, teaching, and research.
50. Which statement correctly describes Jupyter Notebook?
- It is limited to writing Python scripts without output
- It is an interactive environment for creating documents containing live code, outputs, visualizations, and text
- It is only a database management system
- It is a command-line operating system
Answer: B) It is an interactive environment for creating documents containing live code, outputs, visualizations, and text
Explanation:
Jupyter Notebook provides an interactive computational document environment where code, results, visualizations, mathematical content, and explanatory text can be combined.
Advertisement
Advertisement