1) When was Python released? 2) Who developed Python? 3) Is Python an Object Oriented Language? 4) „Python is an interpreted language‟. What does it mean to you? 5) Python is a Free and Open Source language. What do you understand by this feature? 6) In how many ways, can you work in Python? 7) What is the difference between Interactive mode and Script Mode in Python? 8) Which of the following are not valid strings in Python? (a)”Hello” (b) “Hello„ (c)‟Hello„ (d) „Hello” (e) Hello 9) What is None literal in Python? 10) What is the error in following code: x, y =7 ? 11) what will the following code do: a=b=18 ? 12) Following code is creating problem X = 0281, find reason. 13) How many types of sequences are supported in Python? 14) Why is Boolean considered a subtype of Integers? 15) Out of the following operators, which ones can be used with strings? =, -, *, /, //, %, >, <>, in, not in, <= 16) which of the following is not a Python legal string operation? (a)‟abc‟+‟abc‟(b) „abc‟*3 (c)‟abc‟+ 3 (d)‟abc‟.lower() 17) How can you create multi-line strings in Python? 18) From the string S = “CARPE DIEM”. Which ranges return “DIE” and “CAR”? a. Which functions would you chose to use to remove leading and trailing white spaces from a given string? 19) If a is [1, 2, 3], what is the difference (if any) between a*3 and [a, a, a]? 20) If a is [1, 2, 3], is a *3 equivalent to a + a + a? 21) If a is [1, 2, 3], what is the meaning of a [1:1] = 9? 22) What are list slices? 23) Does a slice operator always produce a new list? 1|P age 24) What are nested Lists? 25) Suggest appropriate functions for the following tasks – a) To check whether the string contains digits. b) To find the occurrence a string within another string. c) To convert the first letter of a string to upper case. d) To convert all the letters of a string to upper case. e) To check whether all the letters of the string are in capital letters. f) To remove all the white spaces from the beginning of a string.
26) which of the following is not a Python legal string operation?
(a)‟abc‟+‟abc‟ (b) „abc‟*3 (c)‟abc‟ + 3 (d)‟abc‟.lower() 27) Discuss the utility and significance of Lists. 28) What is the length of the tuple shown below? 29) If a is (1, 2, 3), what is the difference (if any) between a*3 and [a, a, a]? 30) If a is (1, 2, 3), is a *3 equivalent to a + a + a? 31) If a is (1, 2, 3), what is the meaning of a [1:1] = 9? 32) Does a slice operator always produce a new Tuple? 33) How is an empty Tuple created? 34) How is a tuple containing just one element created? 35) Can tuples be nested? 36) Why can‟t List can be used as keys? 37) What type of objects can be used as keys in dictionary? 38) Can you change the order of the dictionaries contents? 39) Can you modify the keys in a dictionary? 40) Can you modify the value in a dictionary? 41) Is dictionary Mutable? Why? 42) What is Python primarily used for? 43) Name three basic data types in Python. 44) How do you create a single-line comment in Python? 45) What is the purpose of the len() function in Python? 46) Which keyword is used to initiate a loop in Python? 47) What does the print() function do in Python? 48) What is NumPy used for in Python? 49) Name two primary data structures provided by NumPy. 50) What does the term "pandas" stand for, and what is its main purpose? 51) How do you import the NumPy library in Python? 52) Which pandas data structure is best suited for one-dimensional data with labels? 53) Start with the list[8,9,10]. Do the following using list functions (a) Set the second entry (index 1) to 17 (b) Add 4, 5 and 6 to the end of the list. (c) Remove the first entry from the list. 2|P age (d) Sort the list. (e) Double the list. (f) Insert 25 at index 3 54) Suggest appropriate functions for the following tasks – (a) To check whether the string contains digits. (b) To find the occurrence a string within another string. (c) To convert the first letter of a string to upper case. (d) To convert all the letters of a string to upper case. (f) To check whether all the letters of the string are in capital letters. (g) to remove all the white spaces from the beginning of a string.
55) What would following expression return?
(a) ”Hello World”.upper().lower() (b) ”Hello World”.lower().upper() (c) ”Hello World”.find(“Wor”,1,6) (d) ”Hello World”.find(“Wor”) (e) ”Hello World”.find(“wor”) (f) ”Hello World”.isalpha() (g) ”Hello World”.isalnum() (h) ”Hello World”.isdigit() (i) “123FGH”.isdigit() 56) What will be the output of the following code? Why? (a) 13 or len(13) (b) len(13) or 13 57) What is the error in following Python program with one statement? print(“My name is : “, name) 58) Which of the following are syntactically correct strings? State reason. (a) ”Python is nice Language” (b) “He called me “Friend!” when he came‟ (c) “Very Good‟ (d) “This is a good book‟ (e) “Namaste” (f) “I liked „Harry Potter‟ very much” 59) What will be the sizes of following constants? (a) „\a‟ (b) “\a” (c) “Kumar\‟s” (d) „\”‟ (e) “it‟s” 60) Find the error in the following code: (a) temp=90 (b) a=12 (c) print(“x=”x) Print temp b = a + b print( a And b) (d) a, b, c=2, 8, 4 (e) x = 23 (f) else = 21-4 print(a, b, c) 4 = x c, b, a = a, b, c print(a; b; c) (g) y = x +5 3|P age (h) a=input(“Value: “) (i) print(x = y = 5) print(x,y) b = a/2 print( a, b)
Q. 2 Answer the following. Marks [2/3]
1) What is the difference between a keyword and an identifier? 2) What are literals in Python? How many types of Literals allowed in Python? 3) What factors guide the choice of identifiers in program? 4) What is the difference between an expression and a statement in Python?What are tokens in Python? How many types of tokens allowed in Python? 5) What are operators? What is their function? Give examples of some unary and binary operators. 6) What is the role of indentation in Python? 7) What a range() function does? Give an example. 8) What is a string slice? How is it useful? 9) What do you understand by true copy of a list? How is it different from shallow copy? 10) How many types of strings are supported by Python? 11) What do you understand by term „immutable‟? 12) What are mutable and immutable types in Python? List both of them. 13) What are augmented assignment operators? How are they useful? 14) Explain the difference between a list and a tuple in Python. 15) How do you access elements from a list using indexing? 16) Describe the process of defining and calling a function in Python. 17) What is the purpose of the if statement in Python? 18) Explain the concept of a for loop in Python. 19) How does a while loop work in Python? 20) Explain the advantages of using NumPy arrays over Python lists for numerical operations. 21) Describe the process of installing the pandas library using pip. 22) How do you access a specific element in a NumPy array using indexing? 23) What is a DataFrame in pandas, and how is it different from a Series? 24) Explain the concept of broadcasting in NumPy arrays. 25) What is the syntax of if-elif statement in Python? 26) What are jump statements in Python? Name jump statements with example. 27) What are the advantages of Python? 28) What are the limitations of Python? 29) What is block/code block/suit in Python? 30) What are data types? What are Python‟s built-in core data types? 31) Which data types of Python handle Numbers? 32) What are loops in Python? How many types of loop are there in Python? 33) What is the syntax of if-elif statement in Python? 34) What are jump statements in Python? Name jump statements with example. 4|P age 35) What is a string slice? How is it useful? 36) Which functions would you chose to use to remove leading and trailing white spaces from a given string? 37) How are lists different from strings when both are sequences? 38) What are nested Lists? 39) Discuss the utility and significance of Lists. 40) What is the purpose of the del operator and pop method? Try deleting a slice. 41) What are list slices? 42) What do you understand by immutability? 43) How are Tuples different from Lists when both are sequences? 44) Discuss the utility and significance of Tuples. 45) How can you say that a tuple is an ordered list of objects? 46) How can you add an extra element to a tuple? 47) How are dictionaries different from Lists? 48) When are dictionaries more useful than lists? 49) Discuss the utility and significance of Dictionaries. 50) Why is a dictionary termed as an unordered collection of objects? 51) How do you find the data type of the elements stored in the NumPy arrays? 52) What are ways of creating 1D, 2D and 3D arrays in NumPy? 53) What are ndarrays in NumPy? 54) How are NumPy arrays better than Python‟s lists? 55) How can you reverse a NumPy array? 56) How is np.mean() different from np.average() in NumPy? 57) How do you count the frequency of a given positive value appearing in the NumPy array? 58) How is arr[:,0] different from arr[:,[0]] 59) How do you concatenate 2 NumPy arrays? 60) How do you convert Pandas DataFrame to a NumPy array? 61) What do you understand by Vectorization in NumPy? 62) Define the Pandas/Python pandas? 63) Mention the different types of Data Structures in Pandas? 64) Define Series in Pandas? 65) How can we calculate the standard deviation from the Series? 66) Define DataFrame in Pandas? 67) What are the significant features of the pandas Library? 68) Define the different ways a DataFrame can be created in pandas? 69) Explain Categorical data in Pandas? 70) How can we create a copy of the series in Pandas? 71) How will you create an empty DataFrame in Pandas? 72) How will you add a column to a pandas DataFrame? 73) How to add an Index, row, or column to a Pandas DataFrame? 74) How to Delete Indices, Rows or Columns From a Pandas Data Frame? 75) What is Pandas NumPy array? 5|P age 76) How can we sort the DataFrame? 77) What is Time Series in Pandas? 78) What is Pandas Index? 79) Define Multiple Indexing?
Q. 3 Answer the following. [Marks-5]
1) Explain history of python.
2) Explain iterative statements in detail. 3) What is Python? 4) Discuss Expressions with type and example. 5) Difference between local and global variable. 6) Explain various types of comments with example. 7) Discuss string concatenation. 8) Discuss user defined function with example. 9) Discuss type conversion in python. 10) What does the sequence mean and which three types of data fall into category? 11) Explain Type conversion in python. 12) Explain different ways of string concatenation. 13) What is difference between join () and ‘+’operator. Explain with example. 14) Differentiate break, continue and pass statement with example. 15) How to create string in python? Explain any 5 functions of string with example. 16) Discuss ‘List’ with any five methods in detail. 17) Difference between set and List. 18) Discuss numerical datatype. 19) Discuss operation of tuple with example. 20) What does immutable means and what three types of python data type are consider as immutable?
Q. 4. Answer the following. [Marks-10]
1) Explain Python Data types with example in brief.
2) Give Example any 10 built-in Functions. 3) Discuss Python Features. 4) Explain control structure statements. 5) Discuss collection data types in python. 6) Discuss basic Structure of python. 7) Explain different type of expression in detail 8) Explain string and its function. 9) What is variable? Explain various types of variables in detail. 10) Explain list and its various methods. 11) Explain tuple and its various functions. 12) Analyze the output of the following code snippet: print(list(range(2, 10, 3))). 6|P age 13) Examine the differences between local and global variables in Python, providing examples. 14) Investigate the potential issues that could arise from dividing by zero in a Python program. 15) Evaluate the pros and cons of using a for loop versus a while loop for iterating through a list. 16) Analyze the effects of indentation errors on the execution of Python code. 17) Critique the advantages and disadvantages of using a list to store data compared to using a dictionary. 18) Analyze the output of the following NumPy code: np.arange(2, 11, 2). 19) Examine the potential performance benefits of using vectorized operations with NumPy arrays compared to using loops with Python lists. 20) Investigate the reasons for using the axis parameter in NumPy functions like np.sum() and np.mean(). 21) Evaluate the significance of the index in pandas Series and DataFrames. 22) Analyze the impact of missing data (NaN) on computations involving pandas DataFrames. 23) Explain set and its methods. 24) Explain Dictionary and its methods. 25) Discuss Control structure statements in detail. 26) What is function? Explain different types with example. 27) Concepts of Interpreter based programming language with python.