Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

MATLAB & GNU Octave Module 1

Start here: MATLAB, Octave and a working setup interview questions

Interview questions on “Start here: MATLAB, Octave and a working setup”: warm-ups, then what each harder question tests and how a good answer starts.

12 questions: 4 warm-ups and 8 with model answers · Levels: Fresher to senior

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher

    What is the difference between MATLAB and GNU Octave?

    Answered in the lesson MATLAB and GNU Octave: one language, two tools

  2. Fresher

    How do you find out which Octave version and which BLAS a computer uses?

    Answered in the lesson Install GNU Octave 11.3 and run your first script

  3. Fresher

    What does a semicolon at the end of a line do, and what is ans?

    Answered in the lesson Command window basics: variables, ans and display

  4. Fresher

    In what order does Octave look for a function when a script uses a name?

    Answered in the lesson Scripts, the current folder and the search path

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Fresher to mid

    You set up the computing for a first-year engineering course of 120 students: Octave on their laptops, a campus MATLAB licence, or MATLAB Online (basic). Which do you choose, and what do you check before deciding?

    What it tests
    Choosing from the course's real needs (Simulink, toolboxes, run length, network, licences) rather than habit, and testing the choice on the course's own scripts.
    First step
    List what the scripts and assignments use: Simulink, toolbox functions, MATLAB-only syntax, long runs, labs without a network. Then run every script in Octave 11.3 and in MATLAB Online (basic) and note what fails or hits a limit.
    Follow-ups

    From the lesson MATLAB and GNU Octave: one language, two tools

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.

    Opening the model answers with your pass…

    Model answers open with any MySmartCoPilot pass.

    • Pro pass · 1 week₹79$2.99
    • 30 days₹179$5.99
    • 1 year₹1,699$45

    One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

    It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  2. Mid to senior

    Your research group has 40 MATLAB scripts and must run them on new laptops that have only GNU Octave. How do you find what breaks, fix it, and keep the scripts working in both programs afterwards?

    What it tests
    Planning a portability audit: running everything, sorting failures into missing functions, Octave-only syntax and silent differences, and keeping one tested shared version.
    First step
    Run every script in Octave on its real data and record errors, warnings and results. Then compare the key results with MATLAB's numbers within a tolerance, because silent differences such as Name=value calls raise no error.
    Follow-ups

    From the lesson MATLAB and GNU Octave: one language, two tools

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  3. Mid to senior

    A continuous-integration job runs your checks with octave-cli --eval "run_checks" | tee log.txt, and it passed although one check printed an error. What went wrong, and how do you make a failing check fail the job?

    What it tests
    Knowing that jobs decide by exit statuses, how a shell pipeline reports its status, and how checks must raise errors or exit with a non-zero status.
    First step
    Follow the status from the failing check to the job's last command. Run the Octave command alone and print its status, then run the whole pipeline and print its status, and compare the two numbers.
    Follow-ups

    From the lesson Install GNU Octave 11.3 and run your first script

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  4. Fresher to mid

    The same script prints 1.130973355292325e-04 on your laptop and 1.1310e-04 on a classmate's, and a third laptop differs in the last digit of a long calculation. Explain each difference and how you make the outputs comparable.

    What it tests
    Telling a display difference from a computed one, finding startup files, comparing versions and libraries, and checking values with a tolerance.
    First step
    Separate display from value. The first two show the same number with 16 and 5 significant digits, which points to a startup file setting format long; run the script with --no-init-all and --init-trace to confirm.
    Follow-ups

    From the lesson Install GNU Octave 11.3 and run your first script

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  5. Fresher to mid

    A colleague's script stops with "error: sum(6): out of bound 1 (dimensions are 1x1)". The same lines worked yesterday. How do you find the cause, fix it, and keep it from coming back?

    What it tests
    Reading an Octave error message, knowing that variables hide functions, using which and exist to confirm it, and fixing the cause rather than the symptom.
    First step
    Read the message as Octave does: sum(6) was treated as indexing into something with one element, so the name sum is probably a variable. Check with which sum and exist('sum') in that session.
    Follow-ups

    From the lesson Command window basics: variables, ans and display

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  6. Mid to senior

    Your course checks answers by comparing what each script prints with expected text made in MATLAB. A student's correct Octave answer fails. Explain why, and redesign the check so that correct answers pass in either program.

    What it tests
    Telling display from value, knowing how MATLAB and Octave lay numbers out, and designing value-based checks with tolerances, shapes and types.
    First step
    Compare the two outputs line by line and find what differs: blank lines, e-notation, scale factors or digits. If the numbers agree within rounding, the check is comparing displays, not answers.
    Follow-ups

    From the lesson Command window basics: variables, ans and display

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  7. Fresher to mid

    A thesis script runs only when its own folder is the current folder; from anywhere else it cannot find its data. Your supervisor must run it from another folder on a cluster. How do you fix it, and how do you show the fix works?

    What it tests
    Knowing that relative paths depend on the current folder, building paths from the script's own location, and verifying a fix from more than one folder.
    First step
    Find every path the script opens or writes, such as load('data/loads.txt'), and note that each is relative to the current folder. Then decide where the script should take its bearings from: its own file, not the folder it was started in.
    Follow-ups

    From the lesson Scripts, the current folder and the search path

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  8. Mid to senior

    Eight people in a lab share a folder of helper functions on a network drive, and each added it with savepath. After someone edits a helper, results differ between people. Redesign how projects find and pin the helpers.

    What it tests
    Making a project's search path explicit and repeatable, versioning shared code, and avoiding name clashes under the first-match rule.
    First step
    Separate the two problems: helpers are found through each person's saved path, which nobody can see, and they change in place, so the same script gives different results over time. Fix how they are found, then how they are versioned.
    Follow-ups

    From the lesson Scripts, the current folder and the search path

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes

All MATLAB & GNU Octave interview questions · The MATLAB & GNU Octave track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.