Python - Assessments

  1. Following paths are required while setting up PySpark environment.

    1. Spark_Home
    2. py4j
    3. None of the above
  2. If the following code is run in python what would you result

                    Num = '5'*'5'
     Ans. TypeError           
  3. What is the relation between docker image and docker container?

    1. A container is a runnable copy of the image
    2. A container contains images
    3. A container is a template for creating images
    4. An image is a container
  4. Which are the libraries in Python that support threads?

    1. thread
    2. threading
    3. _threading
    4. none of the above
  5. What will be the output of the following Python code?

                    myDict = {1:'Food',2:'Clothing',3:'Shelter'}
                    Print(myDict.get(4,5))
       Ans. 5       
  6. Value of Meta Attributes and all other Non-Meta Attributes are treated differently in Orange, True or False.
    Ans. True

  7. How can make a python script executable on Unix?

    1. The script file mode must be runnable, and the last line of the script should be #! followed by the path of the python interpreter.
    2. The script file mode must be executable, and the 2nd line of the script should be @ followed by the path of the python interpreter.
    3. The script file mode must be executable, and the 1st line of the script should be @ followed by the path of the python interpreter.
    4. The script file mode must be executable, and the 1st line of the script should be #! followed by the path of the python interpreter.
    5. The script file mode must be executable, and the last line of the script should be @ followed by the path of the python interpreter.
  8. This port is used for default HTTP connection. Ans. 80

  9. Python features:

    1. Statically typed, Interpreted, Extensible, Portability only, OOP and not procedure
    2. Platform dependent, statically typed, Interpreted, Extensible, Portability
    3. High-level programming language, Platform independent, Dynamically typed, Interpreted, Extensible
    4. High-level programming language, Platform independent, statically typed, Interpreted, Extensible
    5. Platform dependent, Dynamically typed, Interpreted, Extensible, Portability
  10. In orange, wrapping is performed to retain the information about the

    1. Feature names
    2. Feature values
    3. Feature names and values
    4. None.
  11. Which function will print all the rows from the data frame of the 4th column.
    Ans. print(df.iloc[:, 3])

  12. What is the value of colors[2]?

                Colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
     Ans. Yellow           
  13. Multithreaded Python Server Program includes which of the following modules?

    1. Python-Server.py
    2. Python-ClientA.py
    3. Python-ClientB.py
    4. None of the above
  14. Pandas support visualization of data using Matplotlib. Matplotlib contains which act as a container for constraint plots. Either it may contain one subplot or more subplots. Into Matplotlib is called ____ object.

    1. Figure, axis
    2. Chart, edges
    3. Figure, plot
    4. Subplot, plot
  15. What is the output for the below simple snippet?

                Import re
                str = " Accenture - High Performance Delivered"
                x = re.split("\s", str)
                print(x)
    Ans. ['Accenture', '-', 'High', 'Performance', 'Delivered']            
  16. What does CIA stand for?

    1. Confidentiality, Integrity, Availability
    2. Coding, Integration, Availability
    3. Confidentiality, Integration, Access
    4. Cryptography, Integrity, Availability
  17. Kivy GUI, Library, Support, Following of a Thing System.

    1. android
    2. windows
    3. ios
    4. linux
      Ans. ALL
  18. The following parameter of the Spark context is used for Spark installation directory.

    1. Master
    2. Conf
    3. Gateway
    4. Spark home
  19. From Flask, import Flask, What is the difference between Flask and flask?

    1. Both are the same
    2. flask is the framework while Flask is a Python class datatype
    3. flask is the framework while Flask is a Python class datatype
    4. None of the above
  20. Which of the following is not a driver for Neo4j in Python?

    1. Neo4jRestClient
    2. py2neo
    3. neo4j-driver
    4. neo-py
  21. What is the output of the following piece of code?

                class Demo:
                    def check(self):
                        return " Demo's check "
                    def display(self):
                        print(self.check())
                class Demo_Derived(Demo):
                    def check(self):
                        return " Derived's check "
                Demo().display()
                Demo_Derived().display()
         
    Ans. Demo's check
    Derived's check
  22. Which library will be used to do network programming?

    1. Socket
    2. Network
    3. Netsocket
    4. None of the above
  23. What are the new form elements introduced in HTML5?

    1. Datalist
    2. Keygen
    3. Output
    4. Div
  24. Spark Context used to launch a JVM and create a Java Spark Context by default.

    1. Py4j
    2. Pyspark
    3. Numpy
  25. Scrapy sends emails using the following method.

    1. By using a standard constructor
    2. By using scrapy settings object
  26. What are the data instances in Orange?

    1. Vectors
    2. Vector access through index
    3. Vector access through feature name
  27. The following parameters are the Spark context we use for initializing a new JVM.

    1. Master
    2. Conf
    3. Gateway
    4. Spark home
  28. Pitchframer will not be used for web development.

    1. Django
    2. PyFrame
    3. Flash
    4. Pyramid
  29. Pygame can handle following objects.

    1. Image formats
    2. Joysticks
    3. Cursors
    4. All of the above
  30. We can configure the number of bits we want to use as a resolution by calling the following method of an mraa.Aio instance

    1. setADCResolution.
    2. setBit.
    3. setResolutionBits
    4. all of the above
  31. Following model can be built for image processing using TensorFlow.

    1. CNN
    2. Inception
    3. QuocNet
  32. Which of the following is an example of Stochastic Graph Generator?

    1. petersen = nx.petersen_graph()
    2. K_5 = nx.complete_graph(5)
    3. red = nx.random_lobster(100, 0.9, 0.9)
    4. lollipop = nx.lollipop_graph(10, 20)
  33. from pyspark import SparkContext

                sc = SparkContext("local", "Collect app")
                words = sc.parallelize([
                    "scala",
                    "java",
                    "hadoop",
                    "spark",
                    "spark vs hadoop",
                    "pyspark"
                ])
                coll = words.collect()
                print "Elements in RDD ->%s" % (coll)
                

    What is the output?

    1. "Elements in RDD -> [ 'scala', 'hadoop', 'java', 'spark vs hadoop', 'spark', 'pyspark', ]"
    2. Number of elements in RDD ? 8
    3. Number of elements in RDD ? 6
    4. None of the above
  34. Pandas consist of static and moving window.

    1. Linear regression
    2. Panel regression
    3. Linear and panel regression
    4. None of the above
  35. What is the method to retrieve the list of all active threads.

    1. threads()
    2. enumerate()
    3. getThreads()
    4. getList()
  36. import pandas as pd

                df = pd.DataFrame()
                print(df)
                

    The output will be?

    1. "Empty DataFrame Columns: [0, 0] Index: [0, 0]"
    2. "Empty DataFrame Columns: [0] Index: [0]"
    3. "Empty DataFrame Columns: [] Index: []"
    4. None of the Mentioned

  37. SSL and HTTPS, which one is more secure in terms of security.
    Ans. HTTPS

  38. HAAR Cascade in Python can be used for the following.
    1. Face detection
    2. Car detection
    3. Tree detection

  39. Which is not a logistic regression model in Python?
    1. Sklearn.SGDClassifier(loss=log)
    2. Sklearn.linear_model.LogisticRegression
    3. Sklearn.LogisticRegression
    4. import math def sigmoid(x): return 1/(1+math.exp(-x))

  40. from pyspark import SparkContext
  41.         sc = SparkContext("local", "Reduce app")
            nums = sc.parallelize([1, 2, 3, 4, 5])
            adding = nums.reduce(add)
            print "Adding all the elements -> %i" % (adding)
            

    What is the output?

    1. Adding all the elements -> 12
    2. Adding all the elements -> 13
    3. Adding all the elements -> 14
    4. None of the above

  42. All the version control tools.
    1. CVS
    2. SVN
    3. Mercurial
    4. Docker

  43. Classification Algorithm in Orange use following object.
    1. Learners
    2. Classifier
    3. Regression model
    4. None of the above

  44. corpus = ["Apple Orange Orange Apple", "Apple Banana Apple Banana", "Banana Apple Banana Banana Banana Apple", "Banana Orange Banana Banana Orange Banana", "Banana Apple Banana Banana Orange Banana"] from sklearn.feature_extraction.text import CountVectorizer vectorizer = CountVectorizer() vectorizer fit(corpus) corpus_vec = vectorizer transform(corpus).toarray() print(corpus_vec) What will be the output of the script?
    1. matrix with values
    2. vector with values
    3. null vector
    4. scalar

  45. Which of the following distance measures do we use in case of a categorical variable in K-NN?
    1. sklearn.metrics.hamming_loss
    2. sklearn.metrics.pairwise.euclidean_distances
    3. sklearn.metrics.pairwise.manhattan_distances

  46. Variables are used for aggregating the information through associative and commutative operations.
    1. Broadcast
    2. Accumulator

  47. In PySpark, Storage Level Decide Following.
    1. RDD should be stored in memory
    2. RDD should be stored on disk
    3. Whether to serialize RDD and whether to replicate RDD partitions.

  48. from pyspark import SparkContext
  49.         sc = SparkContext("local", "count app")
            words = sc.parallelize([
                "scala",
                "java",
                "Hadoop",
                "spark",
                "spark vs Hadoop",
                "pyspark"
            ])
            counts = words.count()
            print "Number of elements in RDD -> %i" % (counts)
            

    What is the output?

    1. 8
    2. 6
    3. Number of elements in RDD ? 8
    4. Number of elements in RDD ? 6

  50. Which of the following is a classification algorithm used in Orange?
    1. Orange.classification Logistic RegressionLearner
    2. Orange.classification.knn.KNNLearner
    3. Orange.classification.Random ForestLearner

  51. What is the output of the below code?
  52.         >>> import os
            >>> os.listdir()
            
    1. List the content of the python directory
    2. List the content of the operating system directory
    3. List the content of the operating system dictionary from where python invokes
    4. None of the above

Comments

Popular posts from this blog

Data Visualization with Tableau

Deals

Unlocking the Power of Effective Trading Strategies

Contact Form

Name

Email *

Message *