Sample Questions

Sample Questions

For the Scilab Online Test the level of difficulty is of Intermediate Level. There are Advanced Level Questions for you
to practice.

Intermediate Level

  1. Write a function that takes a vector and counts how many even numbers there are. [Also- odd numbers]

      (i) Write a function that returns a vector of all the even valued elements in a given vector. Eg, if the given 
           vector is [2 2 4 5 6 9], the returned vector is [2 2 4 6]

     (ii) Write a function that returns a vector of all the elements in even positions in a given vector, ie. every
          second element in the vector. Eg, if the given vector is [2 2 4 5 6 9], the returned vector is [2 5 9]

2.  Given a vector of heights of students in a class (in meters), return the average height.

     (i) Given an n by 2 that has the heights of students in a class, where the first column is the part of the
         height before the decimal point (in meters), and the second column is the part of the height after
         the decimal point (ie. in cm), return an n by 1 vector that contains the height of the students in m.
         Also: in cm. Eg., a row [1 63] means that the height of the person is 1m and 63cm.

3.  Push and pop from a stack

4.  Given the matrices A and b that represent a matrix equation of the form Ax = b, write a function that
     determines the value of x_i using Cramer's rule.

5.  Write a function that takes a starting value k, and number of iterations n, and returns the root of the
     equation <<enter any equation with roots far apart>> as determined by the Newton Raphson method.

6.  Write a function that accepts two numbers, p and q, and determines the GCD by Euclid's algorithm.
    <<Enter Euclid's algorithm here>>

7.  Write a function that takes a matrix and returns the sum of its Eigenvalues.

8.  Given a vector of unique names, and given one particular name that has to be found, write a function
     that searches for that name from the vector and returns the element number. Proceed to returning
     row/column number from matrix of names

9.  Linear transformation: rotation, reflection, translation, elongation

10. Write a function that takes the number n, divides a unit circle into n equal parts, and returns a vector
      that contains the sine/cosine of the angle of each part, in order. Eg, if n = 4, you must compute the
      angles 0, 90, 180 and 270, and return the sines thus: [0 1 0 -1]

11. A group of objects is travelling in one direction. The elements of the vector m denote the mass of each
      object. The elements of the vector v denote the velocity of each object. What the the total momentum of
      the group of objects. (Write as a function that takes m and v)

     (i) Scratch the one direction bit- elements of the vector theta denote the angle at which each object is
         moving with respect to the X axis. What is the total momentum (magnitude) now? In which direction?

Advanced Level

  1. Fibonacci Sequence generation: recursive/non-recursive while/for. Also, matrix form (Fib^n*seed,
    where Fib = [1 1; 1 0], seed = [1; 0]
    (i) Find the convergent value of the ratios of successive terms of the fibonacci sequence, with an error of 0.001
  2. Row echelon form
  3. Write a function to test whether or not a given number is prime.
  4. Write a function that takes a vector that contains the marks of students and returns the pass/fail status. Any score that is greater than, or equal to 30 is considered to be a passing score. Return a vector of the same size as the input vector, but has a particular element as 1, if the corresponding student passed, and 0 otherwise.
  5. Kronecker product

     

Additional Useful Links

Scilab spoken tutorials:
http://spoken-tutorial.org/Study_Plans_Scilab

Please visit the links mentioned below for conducting a workshop using
Spoken-tutorial.
http://www.spoken-tutorial.org/wiki/index.php/Workshop