This quiz aims at testing your basic knowledge of programming history and beginner Python programming. Don’t forget to push your answers to your remote repository by the end of quiz time. Push all your answers to quiz/2/ folder in your Github project.




  1. (A) What is the closest programming language to machine code (i.e., binary code)?

    (B) Does it need interpretation in order to become machine-comprehensible?

  2. (A) Name the oldest high-level programming language that is still in active daily use.

    (B) Approximately how many decades is it old? ($\pm15$ years is acceptable answer. the decade it was created is also an acceptable answer)

  3. (A) Name a second-generation programming language.

    (B) Which language-generation are Fortran, C, C++, MATLAB, Python, R?

  4. In what decades C, C++, and MATLAB/Python were created, respectively?

  5. Name an ancestor programming language of C.

  6. Name a programming language ancestor of C++.

  7. Name a programming language ancestor of MATLAB and a programming language ancestor of Python.

  8. What are the three common types of errors in computer programs? Provide an example for each category.

  9. Which type of bug (error) in coding is the least dangerous kind and easiest to fix? why?

  10. Which type of bug (error) in coding is the most dangerous and costly kind? why?

  11. Suppose you write a program that has memory leak. What type of programming error you dealing with?

  12. What is the biggest integer (in base 10) that you could store in an int32 type?

  13. What is the difference between int16 and the int64 types?

  14. Write a single-line python statement that applies the relevant Python string manipulator methods to this string,

    Python Is Great For String Manipulation.
    

    and transforms it to the following string and and prints it on screen,

    .noitalupinaM gnirtS roF taerG sI nohtyP
    
  15. Write a single-line python statement that takes the following string,

    Python Is Great For String Manipulation.
    

    and transforms it to the following,

    .otlpnMgit o ar Inhy
    

    Hint: Print every other character in reverse, but note that you need to use Python string slicing method.

  16. How do you define an empty dictionary?

  17. When an integer overflow happens in Python, what is the expected behavior (what value would be assigned to the overflowed variable)? You may explain with an example.

  18. Handling Dictionaries.
    a. Define a Dictionary of all the courses you are taking this semester.
    Use the course numbers as the keys and the course names as the values.
    If you do not know or cannot find the course numbers, use a random number as the key.
    b. Now convert the list of all course numbers to a python list and print it on screen.
    c. Now use a proper command that deletes your least favorite course from the dictionary.

  19. Python script full of syntax errors..

  20. What is the meaning of Value Coercion in Python? Explain with an example.

  21. What is the difference between aliasing and copying values in Python?

  22. What is the difference between a == b and a is b?

  23. Consider the following Python statement.
    a = b = c = [1,2,3]
    

    Explain what the following command does, what is its output, and why?

    a is b is c
    
  24. Consider the following Python statement.
    [a,b] = [c,d] = [4,5]
    

    Explain what the following command does, what is its output, and why?

    [a,b] is [c,d]
    

Comments