Get Latest Exam Updates, Free Study materials and Tips

Q.1:

To open a file c:\scores.txt for reading, we use _____________

A) infile = open(“c:\scores.txt”, “r”) B) infile = open(“c:\\scores.txt”, “r”)
C) infile = open(file = “c:\scores.txt”, “r”) D) infile = open(file = “c:\\scores.txt”, “r”)
Q.2:

To open a file c:\scores.txt for writing, we use ____________

A) outfile = open(“c:\scores.txt”, “w”) B) outfile = open(“c:\\scores.txt”, “w”)
C) outfile = open(file = “c:\scores.txt”, “w”) D) outfile = open(file = “c:\\scores.txt”, “w”)
Q.3:

To open a file c:\scores.txt for appending data, we use ____________

A) outfile = open(“c:\\scores.txt”, “a”) B) outfile = open(“c:\\scores.txt”, “rw”)
C) outfile = open(file = “c:\scores.txt”, “w”) D) outfile = open(file = “c:\\scores.txt”, “w”)
Q.4:

Which of the following statements are true ?

A) When you open a file for reading, if the file does not exist, an error occurs B) When you open a file for writing, if the file does not exist, a new file is created
C) When you open a file for writing, if the file exists, the existing file is overwritten with the new file D) All of the mentioned
Q.5:

To read two characters from a file object infile, we use ____________

A) infile.read(2) B) infile.read()
C) infile.readline() D) infile.readlines()
Q.6:

To read the entire remaining contents of the file as a string from a file object infile, we use ____________

A) infile.read(2) B) infile.read()
C) infile.readline() D) infile.readlines()
Q.7:

What will be the output of the following Python code?

f = None
for i in range (5):
with open("data.txt", "w") as f:
if i > 2:
break
print(f.closed)

A) True B) False
C) None D) Error
Q.8:

To read the next line of the file from a file object infile, we use ____________

A) infile.read(2) B) infile.read()
C) infile.readline() D) infile.readlines()
Q.9:

To read the remaining lines of the file from a file object infile, we use ____________

A) infile.read(2) B) infile.read()
C) infile.readline() D) infile.readlines()
Q.10:

The readlines() method returns ____________

A) str B) a list of lines
C) a list of single characters D) a list of integers
Q.11:

What is the correct syntax of open() function?

A) file = open(file_name [, access_mode][, buffering]) B) file object = open(file_name [, access_mode][, buffering])
C) file object = open(file_name) D) none of the mentioned
Q.12:

What is the output of this program?

fo = open("foo.txt", "wb")
print "Name of the file: ", fo.name
fo.flush()
fo.close()
fo.close()

A) Compilation Error B) Runtime Error
C) No Output D) Flushes the file when closing them
Q.13:

Correct syntax of file.writelines() is?

A) file.writelines(sequence) B) fileObject.writelines()
C) fileObject.writelines(sequence) D) none of the mentioned
Q.14:

Correct syntax of file.readlines() is?

A) fileObject.readlines( sizehint ); B) fileObject.readlines();
C) fileObject.readlines(sequence) D) none of the mentioned
Q.15:

In file handling, what does this terms means “r, a”?]

A) read, append B) append, read
C) all of the mentioned D) none of the the mentioned
Q.16:

What is the use of “w” in file handling?

A) Read B) Write
C) Append D) None of the the mentioned
Q.17:

What is the use of “a” in file handling?

A) Read B) Write
C) Append D) None of the the mentioned
Q.18:

Which function is used to read all the characters?

A) Read() B) Readcharacters()
C) Readall() D) Readchar()
Q.19:

Which function is used to read single line from file?

A) Readline() B) Readlines()
C) Readstatement() D) Readfullline()
Q.20:

Which function is used to write all the characters?

A) write() B) writecharacters()
C) writeall() D) writechar()
Q.21:

The process of pickling in Python includes:

A) conversion of a list into a datatable B) conversion of a byte stream into Python object hierarchy
C) conversion of a Python object hierarchy into byte stream D) conversion of a datatable into a list
Q.22:

To sterilize an object hierarchy, the _____________ function must be called. To desterilize a data stream, the ______________ function must be called.

A) dumps(), undumps() B) loads(), unloads()
C) loads(), dumps() D) dumps(), loads()
Q.23:

Pick the correct statement regarding pickle and marshal modules.

A) The pickle module supports primarily .pyc files whereas marshal module is used to sterilize Python objects B) The pickle module keeps track of the objects that have already been sterilized whereas the marshal module does not do this
C) The pickle module cannot be used to sterilize user defined classes and their instances whereas marshal module can be used to perform this task D) The format of sterilization of the pickle module is not guaranteed to be supported across all versions of Python. The marshal module sterilization is compatible across all the versions of Python
Q.24:

What will be the output of the following Python code?
pickle.HIGHEST_PROTOCOL

A) 4 B) 5
C) 3 D) 6
Q.25:

W Which of the following Python codes will result in an error?
object = ‘a’

A) >>> pickle.dumps(object) B) >>> pickle.dumps(object, 3)
C) >>> pickle.dumps(object, 3, True) D) >>> pickle.dumps(‘a’, 2)
Q.26:

Which of the following functions can be used to find the protocol version of the pickle module currently being used?

A) pickle.DEFAULT B) pickle.CURRENT
C) pickle.CURRENT_PROTOCOL D) pickle.DEFAULT_PROTOCOL
Q.27:

The output of the following two Python codes is exactly the same.

object
'a'
CODE 1
>>> pickle.dumps('a', 3)
CODE 2
>>> pickle.dumps(object, 3)

A) True B) False
Q.28:

Which of the following functions can accept more than one positional argument?

A) pickle.dumps B) pickle.loads
C) pickle.dump D) pickle.load
Q.29:

Which of the following functions raises an error when an unpicklable object is encountered by Pickler?

A) pickle.PickleError B) pickle.PicklingError
C) pickle.UnpickleError D) pickle.UnpicklingError
Q.30:

The pickle module defines ______ exceptions and exports _______ classes.

A) 3, 2 B) 2, 3
C) 3, 4 D) 4, 3
Q.31:

Which of the following cannot be pickled?

A) Functions which are defined at the top level of a module with lambda B) Functions which are defined at the top level of a module with def
C) Built-in functions which are defined at the top level of a module D) Classes which are defined at the top level of a module
Q.32:

If __getstate__() returns _______________ the __setstate__() module will not be called on pickling.

A) True value B) False value
C) ValueError D) OverflowError
Q.33:

Lambda functions cannot be pickled because:

A) Lambda functions only deal with binary values, that is, 0 and 1 B) Lambda functions cannot be called directly
C) Lambda functions cannot be identified by the functions of the pickle module D) All lambda functions have the same name, that is, ""
Q.34:

The module _______________ is a comparatively faster implementation of the pickle module.

A) cPickle B) nPickle
C) gPickle D) tPickle
Q.35:

The copy module uses the ___________________ protocol for shallow and deep copy.

A) pickle B) marshal
C) shelve D) copyreg
Q.36:

Config() in Python Tkinter are used for

A) destroy the widget B) place the widget
C) change property of the widget D) configure the widget
Q.37:

Correct way to draw a line in canvas tkinter ?

A) line() B) canvas.create_line()
C) create_line(canvas) D) None of the above
Q.38:

Creating line are come in which type of thing ?

A) GUI B) Canvas
C) Both of the above D) None of the above
Q.39:

Essential thing to create a window screen using tkinter python?

A) call tk() function B) create a button
C) To define a geometry D) All of the above
Q.40:

fg in tkinter widget is stands for ?

A) foreground B) background
C) forgap D) None of the above
Q.41:

For user Entry data, which widget we use in tkinter ?

A) Entry B) Text
C) Both of the above D) None of the above
Answer & Explanation
Q.42:

For what purpose, the bg is used in Tkinter widget ?

A) To change the direction of widget B) To change the size of widget
C) To change the color of widget D) To change the background of widget
Answer & Explanation
Q.43:

From which keyword we import the Tkinter in program?

A) call B) from
C) import D) All of the above
Answer & Explanation
Q.44:

GUI stands for

A) Graph user interaction B) Global user interaction
C) Graphical user interface D) Graphical user interaction
Answer & Explanation
Q.45:

How pack() function works on tkinter widget ?

A) According to x,y coordinate B) According to row and column vise
C) According to left,right,up,down D) None of the above
Answer & Explanation
Q.46:

How the grid() function put the widget on the screen ?

A) According to x,y coordinate B) According to row and column vise
C) According to left,right,up,down D) None of the above
Answer & Explanation
Q.47:

How the place() function put the widget on the screen ?

A) According to x,y coordinate B) According to row and column vise
C) According to left,right,up,down D) None of the above
Answer & Explanation
Q.48:

How we import a tkinter in python program ?

A) import tkinter B) import tkinter as t
C) from tkinter import * D) All of the above
Answer & Explanation
Q.49:

How we install tkinter in system ?

A)pip install python B) tkinter install
C) pip install tkinter D) tkinter pip install
Answer & Explanation
Q.50:

In which of the following field, we can put our Button?

A) Window B) Frame
C) Label D) All of the above
Answer & Explanation
Q.51:

It is possible to draw a circle directly in Tkinter canvas ?

A) Yes B) No
C) No(but possible by oval) D) None Of the above
Answer & Explanation
Q.52:

Minimum number of argument we pass in a function to create a rectangle using canvas tkinter ?

A) 2 B) 4
C) 6 D) 5
Answer & Explanation
Q.53:

Minimum number of argument we require to pass in a function to create a line ?

A) 2 B) 4
C) 6 D) 8
Answer & Explanation
Q.54:

Screen inside another screen is possible by creating

A) Another window B) Frames
C) Buttons D) Labels
Answer & Explanation
Q.55:

title() is used for

A) give a title name to the window B) give a title name to the Button
C) give a title name to the Widet D) None of the above
Answer & Explanation
Q.56:

Tkinter tool in python provide the

A) Database B) OS commands
C) GUI D) All of the above
Answer & Explanation
Q.57:

To change the color of the text in the Button widget, what we use ?

A) bg B) fg
C) color D) cchng
Answer & Explanation
Q.58:

To change the property of the widget after the declaration of widget, what e use ?

A) mainloop() function B) config() function
C) pack() function D) title() function
Answer & Explanation
Q.59:

To delete any widget from the screen which function we use ?

A) stop() B) delete()
C) destroy() D) break()
Answer & Explanation
Q.60:

To get the multiple line user data, which widget we use ?

A) Entry B) Text
C) Both of the above D) None of the above
Answer & Explanation
Q.61:

To hold the screen what we use ?

A) mainloop() function B) pause() function
C) Stop() function D) None of the above
Answer & Explanation
Q.62:

use of the angle attribute are on which widget ?

A) line B) text
C) Button D) All of the above
Answer & Explanation
Q.63:

What is the correct syntax of destroy in tkinter ?

A) destroy(object) B) object.destroy()
C) object(destroy) D) delete(object)
Answer & Explanation
Q.64:

What is the correct way to use the config() function in tkinter ?

A) config(object,property) B) object.config(property)
C) config(property) D) object.property
Answer & Explanation
Q.65:

What is the right way to set the title of the window ?

A) title(win,mytitle) B) win.title(mytitle)
C) title(mytitle).win D) None of the above
Answer & Explanation
Q.66:

What is the Syntax to create a Frame ?

A) Frame(window,options) B) win.frame(options)
C) Both of the above D) None of the above
Answer & Explanation
Q.67:

What is the use of the Entry widget in tkinter python ?

A) Display text on the window B) Display Check button on window
C) Create a user data entry field D) All of the above
Answer & Explanation
Q.68:

What is the use of the mainloop() in Python Tkinter ?

A) To create a window screen B) To Destroy the window screen
C) To Hold the window Screen D) None of the above
Answer & Explanation
Q.69:

What is the use of the pack() function for the tkinter widget ?

A) To pack the widget on the screen B) To define a size of the widget
C) To perform a task by a widget D) To destroy the widget
Answer & Explanation
Q.70:

What is the use of the place() function in tkinter Python ?

A) To put the widget on the screen B) To put the widget on the Button
C) To put the widget on the background D) To destroy the widget
Answer & Explanation
Q.71:

what is Tk() in tkinter python ?

A) It is function B) It is constructor
C) It is widget D) All of the above
Answer & Explanation
Q.72:

What is widget in Tkinter GUI in python

A) That will display on the screen B) That will work in background
C) Both of the above D) None of the above
Answer & Explanation
Q.73:

What we use to change the back ground color any widget ?

A) background B) fg
C) bg D) bground
Answer & Explanation
Q.74:

Which of th following is used to call a function by the Button widget in tkinter python ?

A) call B) cammand
C) contact D) All of the above
Answer & Explanation
Q.75:

Which of the correct way to set the geometry of the window ?

A) geometry(x,y) B) geometry(300x400)
C) geometry(300,400) D) None of the above
Answer & Explanation
Q.76:

Which of the following command are used to install the tkinter ?

A) pip install Tkinter B) pip install python tkinter
C) pip install tkinter python D) None of the above
Answer & Explanation
Q.77:

Which of the following function are used to get the data from the Entry field in Python Tkinter ?

A) get() B) Gettext()
C) Getdata() D) All of the above
Answer & Explanation
Q.78:

Which of the following is clickable in GUI programming ?

A) Button B) Checkbutton
C) Lable D) 1 and 2
Answer & Explanation
Q.79:

Which of the following is correct ?

A) GUI is the part of the canvas B) canvas is the part of the GUI
C) Both of the above D) None of the above
Answer & Explanation
Q.80:

Which of the following is not correct way to import the tkinter in program ?

A) import tkinter from * B) import tkinter as t
C) import tkinter as p D) All of the above
Answer & Explanation
Q.81:

Which of the following is used to put the widget at the screen ?

A) pack() B) place()
C) grid() D) All of the above
Answer & Explanation
Q.82:

Which of the following tool provides a GUI in python

A) Numpy B) Tkinter
C) Scipy D) Opencv
Answer & Explanation
Q.83:

Which of the following we can able to delete using destroy() function ?

A) Button B) Label
C) Frame D) All of the above
Answer & Explanation
Q.84:

Which of the following we can draw using canvas in tkinter ?

A) Line B) Rectangle
C) oval D) All of the above
Answer & Explanation
Q.85:

Which widget are used to get the data from the user ?

A) Button B) Label
C) Entry D) None of the above
Answer & Explanation
Q.86:

Which of the following is used to access the database server at the time of executing the program and get the data from the server accordingly?

A) Embedded SQL B) Dynamic SQL
C) SQL declarations D) SQL data analysis
Q.87:

Which of the following header must be included in java program to establish database connectivity using JDBC ?

A) Import java.sql.*; B) Import java.sql.odbc.jdbc.*;
C) Import java.jdbc.*; D) Import java.sql.jdbc.*;
Q.88:

DriverManager.getConnection(_______ , ______ , ______)
What are the two parameters that are included?

A) URL or machine name where server runs, Password, User ID B) URL or machine name where server runs, User ID, Password
C) User ID, Password, URL or machine name where server runs D) Password, URL or machine name where server runs, User ID
Q.89:

Which of the following invokes functions in sql?

A) Prepared Statements B) Connection statement
C) Callable statements D) All of the mentioned
Q.90:

Which of the following function is used to find the column count of the particular resultset?

A) getMetaData() B) Metadata()
C) getColumn() D) get Count()