0% found this document useful (0 votes)
173 views11 pages

JRE Exam Python July SET-B

The document contains a Python exam with 36 multiple choice questions covering topics such as: - SQL queries involving SELECT, WHERE, UPDATE, DELETE statements - Python programming concepts like functions, lists, dictionaries, classes, inheritance, file handling - Object oriented programming concepts like self, init, super methods - Data types, conditional statements, loops, exceptions The questions test knowledge of Python syntax, built-in functions, OOP principles and SQL to query and manipulate database tables.

Uploaded by

chavanaditya506
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
173 views11 pages

JRE Exam Python July SET-B

The document contains a Python exam with 36 multiple choice questions covering topics such as: - SQL queries involving SELECT, WHERE, UPDATE, DELETE statements - Python programming concepts like functions, lists, dictionaries, classes, inheritance, file handling - Object oriented programming concepts like self, init, super methods - Data types, conditional statements, loops, exceptions The questions test knowledge of Python syntax, built-in functions, OOP principles and SQL to query and manipulate database tables.

Uploaded by

chavanaditya506
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

JRE Exam Python July SET-B

1) Two students appeared at an examination. One of them secured 9


marks more than the other and his marks was 56% of the sum of their
marks. The marks obtained by them are:

A. 39, 30 B. 41, 32 C. 42, 33 D. 43, 34


2) If 20% of a = b, then b% of 20 is the same as:

A. 4% of a B. 5% of a C. 20% of a D. None of these


3) Two numbers A and B are such that the sum of 5% of A and 4% of B is
two-third of the sum of 6% of A and 8% of B. Find the ratio of A : B.

A. 2 : 3 B.1:1 C.3:4 D. 4:3


4) A train can travel 50% faster than a car. Both start from point A at the
same time and reach point B 75 kms away from A at the same time. On
the way, however, the train lost about 12.5 minutes while stopping at
the stations. The speed of the car is:
A.100 kmph B. 110 kmph C.120kmph D. 130 kmph
5) The H.C.F. of two numbers is 23 and the other two factors of their L.C.M.
are 13 and 14. The larger of the two numbers is:

A. 276 B.299 C.322 D.345


6) The main reason that constraints are added to a table is:

A. Constraints add a level of complexity. C. Constraints ensure data integrity.


B. Constraints gives programmers job security. D. None of these

7) In the relational model, relationships between relations or tables are


created by using:

A. Composite keys. B. determinants. C. candidate keys D. foreign keys.


8) The SQL WHERE clause:

A. limits the column data that are returned. C. limits the rows& columns
returned
B. limits the row data are returned. D.None of these

9) SQL can be used to:


A. Modify the database C. Query database data only.
B. Create database structures only. D. All the mentioned.
JRE Exam Python July SET-B

10) The DROP TABLE statement:

A. deletes the table structure only.


B. deletes the table structure along with the table data.
C. works whether or not referential integrity constraints would be violated.
D. is not an SQL statement.
11) SQL query to find all the cities whose humidity is 95 .

A. SELECT city WHERE humidity = 95


B. SELECT city FROM weather WHERE humidity = 95
C. SELECT humidity = 89 FROM weather
D. SELECT city FROM weather
12) How can you change “Hansen” into “Nilsen” in the “LastName”
column in the Persons table?

A. UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’


B. MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
C. MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
D. UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
13) Which of the following command makes the updates performed by
the transaction permanent in the database ?

A. ROLLBACK B. COMMIT C. TRUNCATE D. DELETE


14) What is the meaning of LIKE ‘%0%0%’ ?

A. Feature begins with two 0’s C. Feature has more than two 0’s
B. Feature ends with two 0’s D. Feature has two 0’s in it, at any position
15) Find the names of these cities with temperature and condition
whose condition is neither sunny nor cloudy.
A. SELECT city, temperature, condition FROM weather WHERE condition NOT
IN (‘sunny’, ‘cloudy’)
B. SELECT city, temperature, condition FROM weather WHERE condition NOT
BETWEEN (‘sunny’, ‘cloudy’)
C. SELECT city, temperature, condition FROM weather WHERE condition IN
(‘sunny’, ‘cloudy’)
D. SELECT city, temperature, condition FROM weather WHERE condition
BETWEEN (‘sunny’, ‘cloudy’)
JRE Exam Python July SET-B

16) The following SQL is which type of join: SELECT CUSTOMER_T.


CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID
FROMCUSTOMER_T,ORDER_T WHERE CUSTOMER_T. CUSTOMER_ID =
ORDER_T. CUSTOMER_ID

A. Equi-join B. Natural join C. Outer join D. Cartesian join


17)Which of the following query deletes a job candidate ?
A. BEGIN TRANSACTION;
GO
DELETE FROM HumanResources.JobCandidate WHERE JobCandidateID =
13;
GO
COMMIT TRANSACTION
B. BEGIN TRANSACTION;
GO
DELETE FROM HumanResources.JobCandidate WHERE JobCandidateID =
13;
GO
ROLLBACK TRANSACTION
C. BEGIN TRANSACTION;
GO
DELETE FROM HumanResources.JobCandidate WHERE JobCandidateID =
13; GO
END
D. All of the mentioned.
18) Statement 1:'UNION' returns all distinct rows selected by either
query.
Statement 2:'INTERSECT 'returns all distinct rows selected by both
queries.
Which of the above statements is TRUE?

A. Only statement 1 C. Both statement 1 and statement 2


B. Onlystatement2 D. None of the listed options
JRE Exam Python July SET-B

19) A table is successfully created by executing the following statement:


CREATE TABLE numbers (double_number double,decimal_number
decimal(2,1))
One row is successfully inserted into the numbers table. At this point,
the table contains the following data

double_numbe decimal_numbe
r r

1.5 2.5

The row is updated by executing the following statement:


UPDATE numbersSET double_number = double_number +
0.25,decimal_number = decimal_number + 0.01
Which values are now stored in the double_number and decimal_number
columns:
A. 1.8 and 2.5 B. 1.75 and 2.5 C. 1.8 and 2.51 D. 1.75 and 2.51

20) The table Country contains the following rows:

Name Populatio
n

Nauru 12000

Turks and Caicos 17000


Islands

Tuvalu 12000

Wallis and Futuna 15000

Which of the following statements will return all rows in the table,
sorted by the value in the Population column? Select the best response
A. SELECT Name, Population ASCFROM Country
B. SELECT Name, ORDER BY Population FROM Country
C. SELECT Name, Population FROM Country GROUP BY Population ASC.
D. SELECT Name, Population FROM Country ORDER BY Population
JRE Exam Python July SET-B

21) Find the output of the below code.


def add(a=4,b=0):
return a+b
add(5)
A. 5 B. 9 C. 4 D. None of the above

22) What is the output of the following code snippet?


x = 10
y=5
z=x+y
print(z)

A. 10 B. 5 C. 15 D. 105
23) Which of the following is used to take input from the user in Python?

A. input() B. get() C. read() D. scan()


24) What will be the output of the following code snippet?
print("Hello" + "World")

A. HelloWorld B. Hello World C. Hello+World D. Error


25) .Which of the following is not a property of a list?

A. Ordered C. Contain only same type of elements


B. B. Mutable D. Can contain duplicate values
26) What is the correct way to open a file named "data.txt" in Python?

A. file = open("data.txt", "w") C. file = open("data.txt", "a+")


B. file = open("data.txt", "r+") D. file = open("data.txt", "x")
27) What will be the output of the following code ?
def square(x):
return x ** 2
numbers = [1, 2, 3, 4, 5]
squared_numbers = list(map(square, numbers))
print(squared_numbers)

A. [1, 4, 9, 16, 25] C. [2, 4, 6, 8, 10]


B. [1, 2, 3, 4, 5] D.Error
JRE Exam Python July SET-B

28) Which of the following is used to raise an exception manually in


Python?

A. Raise B. Throw C. except D. assert


29) What is the purpose of the "init" method in a Python class?
A. It is called when an object is created from the class & initialize its attributes
B. It is a reserved method name in Python
C. It is used to define the class constructor
D. It is used to destroy an object of the class
[
What will be the output of the following code snippet?
x = 10
def my_function():
global x
x = 20
my_function()
print(x)
A. 10 B. 20 C. Error D. None
30) What will be the output of the following code?
x = [1, 2, 3]
y=x
y.append(4)
print(x)

A. [1, 2, 3] B. [1, 2, 3, 4] C. [1, 2, 4] D. Error


31) What is the purpose of the "self" parameter in a Python class
method?

A. It represents the current instance of the class B)


B. It is used to access class attributes and methods
C. C) It is used to call other class methods
D. D) It is a reserved keyword in Python
32) What is the purpose of the "readline()" method in Python file
handling?

A. To write a line of text to a file C. To append a line of text to a file


B. To read a line of text from a file D. To check if a line exists in a file
JRE Exam Python July SET-B

33) Which of the following is used to define a private attribute in a


Python class?

A. self.attribute B. Hello World C. _attribute D. Attribute

34) What is the purpose of the "super()" function in Python inheritance?

A. To call the superclass's methods


B. To override the superclass's methods
C. To create a new instance of the superclass
D. To access the subclass's methods

35) What is the output of the below code?


Code
>>> class Basket:
>>> fruits = 0
>>> @classmethod
>>> def add_fruit(cls):
>>> cls.fruits += 1
>>> basket1 = Basket()
>>> basket1.add_fruit()
>>> basket1.add_fruit()
>>> basket2 = Basket()
>>> print(basket2.fruits)
A. 2 B. 1 C. Error D.3

36) Output of below code:


class Class1:
>>> def __init__(self, n):
>>> self.n = n
JRE Exam Python July SET-B

>>> def __add__(self, other):


>>> return self.n – other.n
>>> a = Class1(4)
>>> b = Class1(1)
>>> print(a + b)
A. 5 B. 4 C. 3 D. SyntaxError

37) What is the output of the below code?


Code
>>> class Sum:
>>> def __init__(self, n):
>>> self.n = n
>>> num = 0
>>> if isinstance(int, object):
>>> num += 1
>>> if isinstance(num, object):
>>> num += 4
>>> if isinstance(Sum, object):
>>> num += 6
>>> N = Sum(num)
>>> if isinstance(N, (object, Sum)):
>>> num += 2
>>> print(N.n + num)
A. 20 B. 24 C. 26 D.14
JRE Exam Python July SET-B

38) Which of the following do not give any error?


A. a=4
b=5
if(a>b):
print(‘a>b’)
elif(a<b and a==b):
print(‘a<=b’)
B. a=4
b=5
if(a>b):
print(‘a>b’)
elif:
print(‘a<=b’)
C. a=4
b=5
if(a>b):
print(‘a>b’)
elif(a<b):
print(‘a<b’)
else: print(‘a==b’)
A. a B. b C. c D. Both a and b

40) Which of the following gives the output as 3?


a)
a=10
b=4
if(a&b):
JRE Exam Python July SET-B

print((a-b)/2)
else:
print(a-b/2)
b)
a=10
b=4
if(a^b):
print((a-b)/2)
else:
print(a-b/2)
c)
a=10
b=4
if(~a):
print(a-2*b+1)
else:
print(a-b/2)
d)
a=10
b=4
if(a-b):
print(a-2*(b+1))
else:
print(a-b/2)
A. a B. b C. c D. B
41) What is the default database used by Django?
A. MySQL B. SQLite C. PostgreSQL D. MongoDB
JRE Exam Python July SET-B

42) Which file is responsible for URL routing in Django?


A. views.py B. models.py C. urls.py D. settings.py
43) How do you create a new Django project?
A. django startproject project_name C. django newproject project_name
B. django createproject project_name D. django initproject project_name
44) Which command is used to run the Django development server?
A. python manage.py runserver C. django runserver
B. python server.py D. django start
45)What is the purpose of Django's template engine?
A. To handle user authentication C. To generate HTML dynamically
B. To handle database migrations D. To manage static files
46)How do you define a URL pattern for a view in Django?
A. By adding a URL tag in the HTML template
B. By modifying the settings.py file
C. By adding a URL pattern in the views.py file
D. By modifying the models.py file
47) What is the purpose of Django's migrations?
A. To manage static files C. To update database schema changes over time
B. To handle URL routing D. To create HTML templates
48)Which command is used to create a new Django app?
A. django newapp app_name C. python manage.py createapp app_name
B. python manage.py startapp app_name D. django initapp app_name
49)What is the purpose of Django's ModelForm?
A. To handle form validationC. To define database models
B. To manage static files D. To generate HTML forms dynamically based on
models

50) How do you define a one-to-many relationship between two models in


Django?
A. ForeignKey C. OneToManyKey
B. OneToManyField D. ManyToOneField

You might also like