100% found this document useful (1 vote)
1K views

Python Question Bank

This document contains questions about various topics related to computer science including: - Mobile operating systems and examples of them. - The differences between primary and secondary memory. - Functions of the CU and ALU in a CPU. - Hard disks and their classifications. - Input/output devices. - Key features and data types of the Python programming language. - Tuples, lists, dictionaries in Python. - NumPy and Pandas for data analysis in Python. - Relational and logical operators, variables, data types, and functions in Python. - Random number generation, string manipulation, and conditional/looping constructs in Python. - SQL concepts like DDL, DML,

Uploaded by

Vishal Tiwari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views

Python Question Bank

This document contains questions about various topics related to computer science including: - Mobile operating systems and examples of them. - The differences between primary and secondary memory. - Functions of the CU and ALU in a CPU. - Hard disks and their classifications. - Input/output devices. - Key features and data types of the Python programming language. - Tuples, lists, dictionaries in Python. - NumPy and Pandas for data analysis in Python. - Relational and logical operators, variables, data types, and functions in Python. - Random number generation, string manipulation, and conditional/looping constructs in Python. - SQL concepts like DDL, DML,

Uploaded by

Vishal Tiwari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

UNIT I

1. Explain Mobile Operating System?Give Examples.


2. Describe a computer system .
3. What is difference between primary memory and secondary memory.
4. . Explain the functions of the CU and ALU in the CPU of a computer.
5. What do you understand by a hard disk and how are they classified?

6. List various input and output devices.


7. What are the key features of Python?
8. Is python a case sensitive language?
9. What are the supported data types in Python?
10. Write ouptput of following
a. What is the output of print str if str = 'Hello World!'?
b. What is the output of print str[0] if str = 'Hello World!'?
c. What is the output of print str[2:5] if str = 'Hello World!'?
d. What is the output of print str[2:] if str = 'Hello World!'?
e. What is the output of print str * 2 if str = 'Hello World!'?
11. What are tuples in Python?
12. What is the difference between tuples and lists in Python?
13. What are Python's dictionaries?
14. How will you create a dictionary in python?
15. How will you convert a string to an int in python?
16. What is the purpose of ** operator?
17. What is the purpose of // operator?
18. What is the purpose of is operator?
19. What is the purpose of not in operator?
20. What is the purpose break statement in python?
21. What is the purpose continue statement in python?
22. What is the purpose pass statement in python?
23. Find the largest and smallest numbers in a list.
24. Find the third largest number in a list.
25. Find the sum of squares of the first 100 natural numbers.
26. Find whether a string is a palindrome or not.
27. Given two integers x and n, compute xn.
28. Compute the greatest common divisor and the least common multiple of two integers.
29. Test if a number is equal to the sum of the cubes of its digits. Find the smallest and
largest such numbers in the range of 100 to 1000.
30. Find output of following
a. for x in range(5):
print(x)
b. for x in range(3, 6):
print(x)
c. for x in range(3, 8, 2):
print(x)
d. count = 0
while count < 5:
print(count)
count += 1
e. count = 0
while True:
print(count)
count += 1
if count >= 5:
break
f. for x in range(10):
if x % 2 == 0:
continue
print(x)
g. num = 3
if num > 0:
print(num, "is a positive number.")
print("This is always printed.")
num = -1
if num > 0:
print(num, "is a positive number.")
print("This is also always printed.")
31. What is escape sequeces?
32. What is the function of format() in python.
33. What is the use of import statement in python.
34. What do you mean by module.
35. Write a short note on Python’s standard library.

UNIT II

1. What is Pandas/Python Pandas?


2. What is a pandas DataFrame?
3. What can I import from NumPy?
4. What is PIP for Python?
5. List various key features of pandas.
6. What are the different structures Pandas deals with.
7. What do you mean by series in panda . Give Example.
8. What do you mean by Data Frame in panda . Give Example.

9. Write a program to locate the 3 largest values in a data frame.


10. Write a program to replace all negative values in a data frame with a 0.
11. Write ouput of following code:
import pandas as pd
my_series=pd.Series([1,2,2.5,'ajay',56.5])
print(my_series.head())
print(my_series.head(2))
12. Write ouput of following code:
import pandas as pd
my_series=pd.Series([1,2,2.5,'ajay',56.5,2.55,23])
print(my_series.tail())
print(my_series.tail(2))
13. Write ouput of following code:
import pandas as pd
my_series=pd.Series({'Indore':20,'Ujjain':35,'Bhopal':40})
print(my_series[my_series>20])
14. Write python statements to create a data frame for the following data.
Name Age Designation
RAJIV 20 CLERK
SAMEER 35 MANAGER
KAPIL 45 ACCOUNTANT
15. Write the purpose of following functions of dataframe df.
a. df.shape()
b. df.head()
c. df[2:5]
d. df[:]
e. df.columns
16. Write a python program to sort the following data according to age in asceding order.
Name Age Designation
RAJIV 20 CLERK
SAMEER 35 MANAGER
KAPIL 45 ACCOUNTANT

UNIT III
1. What is full form of CSV.
2. What is RDBMS. Give Examples.
a. 1. Create following Variables
b. i) „mystring‟ to contain „hello‟
c. ii) „myfloat‟ to contain „2.5‟
d. iii) „myint‟ to contain „10‟
e. 2. Write the value justification i) 2*(3+4) ii) 2*3+4 iii) 2+3*4
3. What is the type of the following result: i) 1+2.0+3
4. Which of the following is the valid variable name: i) global ii) 99flag iii) sum iv) an$wer
5. Which lines are commented? i) “””This is a comment””” ii) # This is a comment iii) // this is a
comment v) „ „ „ This is a comment‟ „ „
6. MCQ i) The __________ data type allows only True/False values a) bool b) boolean c) Boolean
d) None ii) If the value of a = 20 and b = 20, then a+=b will assign ________ to a a) 40 b) 30 c) 20
d) 10 iii) The ____________ operator is used to find out if division of two number yields any
remainder a) / b) + c) % d) //
What does „immutable‟ mean; which data type in python are immutable.
7. Name four of Python‟s Basic data types? Why are they called so?
8. What are relational operators? Explain with the help of examples.
9. What is an integer?
10. What is a variable? What names may variable have?
11. How are keywords different from variable names?
12. Why are data types important?
13. How can you convert a string to integer and when can it be used?
14. How can text be read from the keyboard? 20. How are comments written in a program?
15. Define a function get Bigger Number (x,y) to take in two numbers and return the bigger of
them.

Functions:
16. What is the difference between methods, functions & user defined functions.
17. Open help for math module i. How many functions are there in the module? ii. Describe how
square root of a value may be calculated without using a math module iii. What are the two data
constants available in math module.
18. Generate a random number n such that i. 0 ≤ n < 6 ii. 2 ≤ n < 37 and n is even
19. Write a program to ask for following as input Enter your first name: Rahul Enter your last
name: Kumar Enter your date of birth Month? March Day? 10 Year? 1992 And display following
on screen Rahul Kumar was born on March 10, 1992.
20. Write a Python function, odd, that takes in one number and returns True when the number is
odd and False otherwise. You should use the % (mod) operator, not if.
21. Define a function „SubtractNumber(x,y)‟ which takes in two numbers and returns the
difference of the two.
22. Write a Python function, fourthPower( ), that takes in one number and returns that value
raised to the fourth power.
23.Write a program that takes a number and calculate and display the log, square, sin and cosine
of it.
24. a) Write a program, to display a tic-tac-toe board on screen, using print statement. b) Write a
program to display a tic-tac-toe board on screen using variables, so that you do not need to write
many print statements?

Conditional and looping construct


25.Write a function to find whether given number is odd or even.
26. Print all multiples of 13 that are smaller than 100. Use the range function in the following
manner: range (start, end, step) where "start" is the starting value of the counter, "end" is the
end value and "step" is the amount by which the counter is increased each time.
27. Write a program using while loop that asks the user for a number, and prints a countdown
from that number to zero. Note: Decide on what your program will do, if user enters a
nExampleative number.
28. Using for loop, write program that prints out the decimal equivalent of ½, , ¼, -- ----,
29 Write a function to print the Fibonacci Series up to an Input Limit.
30. Write a function to generate and print factorial numbers up to n (provided by user).
31. Write a program using a for loop, that calculates exponentials. Your program should ask for
base and exp. value form user. Note: Do not use ** operator and math module.
32 Write a program using loop that asks the user to enter an even number. If the number
entered is not even then display an appropriate message and ask them to enter a number again.
Do not stop until an even number is entered. Print a Congratulatory message at end.

UNIT IV
1.What is SQL?
2.Differentiate between DDL and DML?
3.What is a constraint?
4.What are single row functions ?
5.A table "Animals" in a database has 3 columns and 10 records. What is the degree and rdinality of this
table?
6. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name ends with
'Sharma
7.How primary key is different from unique key.
8.What do you mean by foreign key .
9.What is select and projection operation .
10.What are indexes.
11.What do you mean by DBMS.
12.Why do we need DBMS.
13.How to insert a row in a table.
14.What are joins . Explain its types.
15.Display the name of all students whose stream is not Science
Unit V (Cyber safety)
1. What are the precautions required while browsing a site.
2. What is the use of CAPTCHA .
3. What is an authentic and authorized user .
4. List some positive and negative impact of social networking sites.
5. What is cyber troll.
6. List some popular social networking sites.
7. What are the ethics related to social networking .
8. Difference between Adware and malware.
9. Which of the following seems non harmful
i)Trojan ii) Virus
10. What are the types of Viruses.
11. How we will come to know the site secure for financial transaction
12. What do you mean by phishing .
13. What are the hardware & software requirements to browse a site safely
14. Differentiate Hacking and Cracking .
15. What do you mean by Eavesdropping and Snooping .

You might also like