×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

Bokeh MCQs (Multiple-Choice Questions)

Bokeh is a Python library for creating interactive and browser-based data visualizations. It provides tools for building interactive plots, dashboards, widgets, layouts, and web applications with support for JavaScript-based interactions and Bokeh Server applications.

Bokeh MCQs

These Bokeh multiple-choice questions cover important concepts such as figures, glyphs, data sources, interactive tools, layouts, widgets, callbacks, Bokeh Server, output formats, and plot customization. Practice these Bokeh MCQs to test and improve your knowledge of interactive data visualization with Python.

List of Bokeh MCQs

Here is a list of commonly asked Bokeh MCQs with answers and explanations.

1. What is Bokeh?

  1. A Python web browser
  2. A Python library for interactive data visualization
  3. A database management system
  4. A Python compiler

Answer: B) A Python library for interactive data visualization

Explanation:

Bokeh is a Python visualization library designed for creating interactive visualizations that can be displayed in web browsers.

2. Which Python module provides the figure() function in Bokeh?

  1. bokeh.plotting
  2. bokeh.graphics
  3. bokeh.chart
  4. bokeh.visual

Answer: A) bokeh.plotting

Explanation:

The figure() function is commonly imported from bokeh.plotting to create a new Bokeh plot.

3. Which statement correctly imports the Bokeh figure function?

  1. from bokeh.plotting import figure
  2. import figure from bokeh
  3. from bokeh.figure import plotting
  4. import bokeh.figure()

Answer: A) from bokeh.plotting import figure

Explanation:

The figure function is provided by the bokeh.plotting interface.

4. Which function is commonly used to display a Bokeh plot?

  1. display()
  2. show()
  3. render()
  4. view()

Answer: B) show()

Explanation:

The show() function from bokeh.io or bokeh.plotting is commonly used to display a Bokeh visualization.

5. What is a glyph in Bokeh?

  1. A database record
  2. A visual representation of data on a plot
  3. A Python package
  4. A web server

Answer: B) A visual representation of data on a plot

Explanation:

Glyphs are visual elements used to represent data in Bokeh. Examples include circles, lines, rectangles, bars, patches, and segments.

6. Which glyph is commonly used to represent individual data points?

  1. Circle
  2. Rectangle
  3. Patch
  4. Line

Answer: A) Circle

Explanation:

Circle or scatter glyphs can be used to represent individual observations as points on a Bokeh plot.

7. Which method can be used to create a line glyph?

  1. line()
  2. draw_line()
  3. plot_line()
  4. create_line()

Answer: A) line()

Explanation:

A Bokeh figure provides glyph methods such as line() for rendering line-based visualizations.

8. Which Bokeh glyph is commonly used for bar charts?

  1. vbar()
  2. barplot()
  3. columnplot()
  4. bar_chart()

Answer: A) vbar()

Explanation:

The vbar() glyph creates vertically oriented bars. Bokeh also provides hbar() for horizontal bars.

9. Which glyph is used to create horizontal bars?

  1. horizontal_bar()
  2. hbar()
  3. barh()
  4. horizontal()

Answer: B) hbar()

Explanation:

The hbar() glyph is used to create horizontally oriented bars in Bokeh.

10. Which object is Bokeh's fundamental data structure for many plots and data tables?

  1. ColumnDataSource
  2. DataFrameSource
  3. PlotData
  4. BokehData

Answer: A) ColumnDataSource

Explanation:

ColumnDataSource is a central Bokeh data structure that maps column names to sequences or arrays and can drive plots and other components.

11. From which module can ColumnDataSource be imported?

  1. bokeh.models
  2. bokeh.data
  3. bokeh.source
  4. bokeh.plotting.data

Answer: A) bokeh.models

Explanation:

ColumnDataSource is available from bokeh.models.

12. Which Python object can be directly used to initialize a ColumnDataSource?

  1. Dictionary
  2. Pandas DataFrame
  3. Both A and B
  4. Only a string

Answer: C) Both A and B

Explanation:

A ColumnDataSource can be initialized using a dictionary containing column data or a Pandas DataFrame, among other supported inputs.

13. What does each column in a ColumnDataSource represent?

  1. A sequence of values
  2. A plot title
  3. A toolbar
  4. A callback function

Answer: A) A sequence of values

Explanation:

A ColumnDataSource maps column names to sequences or arrays. Glyphs can refer to these columns when rendering data.

14. What requirement applies to the columns in a ColumnDataSource?

  1. All columns must have the same number of entries
  2. All columns must contain strings
  3. All columns must contain integers
  4. All columns must have unique values

Answer: A) All columns must have the same number of entries

Explanation:

Columns in a ColumnDataSource represent rows of related data, so the columns are expected to have matching lengths.

15. Which Bokeh method can be used to update selected values in a ColumnDataSource without replacing the entire dataset?

  1. patch()
  2. modify()
  3. change_rows()
  4. update_rows()

Answer: A) patch()

Explanation:

The patch() method can update specific locations in columns of a ColumnDataSource.

16. Which ColumnDataSource method is designed to add new data to an existing source?

  1. stream()
  2. append()
  3. add()
  4. push()

Answer: A) stream()

Explanation:

The stream() method is used to add new rows of data to a ColumnDataSource, making it useful for streaming or continuously updated visualizations.

17. Which module contains Bokeh layout functions such as row() and column()?

  1. bokeh.layouts
  2. bokeh.structure
  3. bokeh.ui
  4. bokeh.containers

Answer: A) bokeh.layouts

Explanation:

The bokeh.layouts module provides functions for arranging plots and widgets into layouts.

18. What does the row() layout generally do?

  1. Places components horizontally
  2. Places components vertically
  3. Deletes components
  4. Converts plots into tables

Answer: A) Places components horizontally

Explanation:

The row() layout arranges Bokeh components horizontally.

19. What does the column() layout generally do?

  1. Places components horizontally
  2. Places components vertically
  3. Creates a database column
  4. Creates a data source

Answer: B) Places components vertically

Explanation:

The column() layout arranges components vertically.

20. Which layout function can be used to arrange components in a grid-like structure?

  1. gridplot()
  2. grid()
  3. tableplot()
  4. matrixplot()

Answer: A) gridplot()

Explanation:

gridplot() is used to arrange multiple Bokeh plots in a grid layout.

21. Which Bokeh tool allows users to display information when hovering over glyphs?

  1. HoverTool
  2. InfoTool
  3. DisplayTool
  4. PointerTool

Answer: A) HoverTool

Explanation:

HoverTool provides tooltips and hover interactions for glyphs.

22. Which tool is commonly used to zoom into a Bokeh plot using a rectangular selection?

  1. BoxZoomTool
  2. RectangleTool
  3. AreaZoomTool
  4. SquareZoomTool

Answer: A) BoxZoomTool

Explanation:

BoxZoomTool allows users to select a rectangular region and zoom the plot to that region.

23. Which tool allows users to move or pan around a Bokeh plot?

  1. PanTool
  2. MoveTool
  3. DragTool
  4. ShiftTool

Answer: A) PanTool

Explanation:

PanTool allows users to move the visible range of a plot interactively.

24. Which tool restores a plot to its original range?

  1. ResetTool
  2. RestoreTool
  3. OriginalTool
  4. HomeTool

Answer: A) ResetTool

Explanation:

The ResetTool restores the plot ranges to their initial state.

25. Which Bokeh tool can be used to select individual data points?

  1. TapTool
  2. PointTool
  3. SelectPointTool
  4. ClickTool

Answer: A) TapTool

Explanation:

TapTool supports selection of glyphs by clicking or tapping them.

26. Which Bokeh object is used to create interactive controls such as sliders?

  1. Widget
  2. Controller
  3. InputObject
  4. ControlPanel

Answer: A) Widget

Explanation:

Bokeh provides widgets such as sliders, buttons, selectors, date pickers, and switches for creating interactive user interfaces.

27. Which Bokeh widget allows a user to select a value from a range?

  1. Slider
  2. RangeBox
  3. ValueSelector
  4. RangeWidget

Answer: A) Slider

Explanation:

The Slider widget allows users to select a numeric value between specified limits.

28. Which widget provides a list of choices that users can select from?

  1. Select
  2. ChoiceList
  3. OptionBox
  4. ListInput

Answer: A) Select

Explanation:

The Bokeh Select widget provides a dropdown-style interface for choosing an option.

29. Which widget provides a simple on/off control?

  1. Switch
  2. ToggleButton
  3. OnOff
  4. BooleanInput

Answer: A) Switch

Explanation:

The Switch widget provides an on/off toggle interface.

30. Which Bokeh class is used to provide JavaScript callbacks?

  1. CustomJS
  2. JavaScriptCallback
  3. JSFunction
  4. BrowserCallback

Answer: A) CustomJS

Explanation:

CustomJS allows JavaScript code to execute in the browser in response to Bokeh model changes or events.

31. Where does a CustomJS callback execute?

  1. In the browser's JavaScript environment
  2. Only inside a database
  3. Inside the Python compiler
  4. Inside the operating system kernel

Answer: A) In the browser's JavaScript environment

Explanation:

A CustomJS callback executes JavaScript in the browser. It does not directly execute Python code.

32. Which method can attach a CustomJS callback to a property change?

  1. js_on_change()
  2. on_js_change()
  3. attach_js()
  4. callback_js()

Answer: A) js_on_change()

Explanation:

The js_on_change() method attaches JavaScript callbacks to Bokeh model property changes or supported events.

33. Which method can attach a callback to a specific Bokeh event such as a tap?

  1. js_on_event()
  2. on_event_js()
  3. event_callback()
  4. attach_event()

Answer: A) js_on_event()

Explanation:

js_on_event() can associate a CustomJS callback with Bokeh events such as tap interactions.

34. Which method provides a convenient way to link one Bokeh model property to another?

  1. js_link()
  2. link_property()
  3. bind_property()
  4. connect_property()

Answer: A) js_link()

Explanation:

js_link() provides a convenient way to link one Bokeh model property to another using JavaScript-side behavior.

35. What is the primary purpose of Bokeh Server?

  1. To provide interactive applications with server-side Python callbacks
  2. To compile Python into machine code
  3. To store images permanently
  4. To replace web browsers

Answer: A) To provide interactive applications with server-side Python callbacks

Explanation:

Bokeh Server allows Bokeh applications to communicate with Python code on the server, enabling richer interactions and Python callbacks.

36. Which command is commonly used to run a Bokeh application from the command line?

  1. bokeh serve
  2. bokeh start
  3. bokeh runserver
  4. bokeh application

Answer: A) bokeh serve

Explanation:

The bokeh serve command is used to run Bokeh applications through the Bokeh Server.

37. Which function provides access to the current Bokeh document in a server application?

  1. curdoc()
  2. current_document()
  3. getdoc()
  4. document()

Answer: A) curdoc()

Explanation:

The curdoc() function returns the current Bokeh document, which is commonly used when building Bokeh Server applications.

38. Which function is used to create a static HTML output file for a Bokeh visualization?

  1. output_file()
  2. html_output()
  3. save_html()
  4. create_html()

Answer: A) output_file()

Explanation:

output_file() configures Bokeh to generate an HTML file when the visualization is shown or saved.

39. Which function can save a Bokeh model to an output file?

  1. save()
  2. store()
  3. write_plot()
  4. export_plot()

Answer: A) save()

Explanation:

The Bokeh save() function can save a Bokeh model as an output document, such as an HTML document.

40. Which function can be used to generate a complete HTML page containing a standalone Bokeh document?

  1. file_html()
  2. html_page()
  3. create_html()
  4. standalone_html()

Answer: A) file_html()

Explanation:

file_html() can generate a complete HTML document containing a standalone Bokeh document.

41. Which Bokeh class is used to create a table for displaying tabular data?

  1. DataTable
  2. DataGrid
  3. TableView
  4. DataFrameTable

Answer: A) DataTable

Explanation:

DataTable is a Bokeh widget used to display tabular data and can be connected to a ColumnDataSource.

42. Which Bokeh object is used to define columns in a DataTable?

  1. TableColumn
  2. DataColumn
  3. ColumnDefinition
  4. TableField

Answer: A) TableColumn

Explanation:

TableColumn defines how a column from the data source should be represented in a Bokeh DataTable.

43. Which property can be used to specify the width of a Bokeh plot?

  1. width
  2. plot_width_only
  3. canvas_width
  4. size_width

Answer: A) width

Explanation:

Bokeh plots have width and height properties that control the dimensions of the plot.

44. Which Bokeh property can be used to control responsive sizing?

  1. sizing_mode
  2. responsive
  3. auto_size_mode
  4. screen_mode

Answer: A) sizing_mode

Explanation:

The sizing_mode property controls how a Bokeh layout or plot adjusts its size relative to available space.

45. Which property can be used to set the title of a Bokeh plot?

  1. title
  2. plot_title_text
  3. heading
  4. caption

Answer: A) title

Explanation:

The title property represents the title of a Bokeh plot and can be customized through the plot's title object.

46. Which method can be used to select Bokeh models from a plot?

  1. select()
  2. find()
  3. query()
  4. locate()

Answer: A) select()

Explanation:

The select() method can be used to query Bokeh models based on criteria such as type or name.

47. Which function can export a Bokeh plot as a PNG image?

  1. export_png()
  2. save_png()
  3. plot_to_png()
  4. png_export()

Answer: A) export_png()

Explanation:

Bokeh provides export_png() for exporting plots or layouts as PNG images. Image export requires the appropriate browser automation dependencies.

48. Which output format is scalable and suitable for vector graphics?

  1. SVG
  2. TXT
  3. CSV
  4. JSONL

Answer: A) SVG

Explanation:

SVG is a scalable vector graphics format. Bokeh supports SVG output, including through export_svg() and related export functionality.

49. Which statement about standalone Bokeh documents is correct?

  1. They always require a Bokeh Server
  2. They can work without a Bokeh Server
  3. They can only be viewed inside Python
  4. They cannot contain JavaScript interactions

Answer: B) They can work without a Bokeh Server

Explanation:

Standalone Bokeh documents can be embedded or saved as HTML and do not require a Bokeh Server. They can still provide browser-side interactions using JavaScript callbacks and BokehJS.

50. Which statement best describes Bokeh?

  1. It is only a static plotting library
  2. It is only a database visualization tool
  3. It provides interactive visualizations, widgets, layouts, and web applications
  4. It is a replacement for JavaScript

Answer: C) It provides interactive visualizations, widgets, layouts, and web applications

Explanation:

Bokeh provides a broad set of tools for interactive visualization, including plots, glyphs, data sources, widgets, layouts, callbacks, standalone documents, and Bokeh Server applications.

Advertisement
Advertisement

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2026 www.includehelp.com. All rights reserved.