The document contains two questions about Python programming and SQL queries.
Question 1 asks students to write Python programs to: (1) create a new list with corresponding positive, negative, or zero values based on another list; and (2) create a new dictionary removing any keys with duplicate values from an existing dictionary.
Question 2 asks students to: (1) identify the primary key of a SQL table; (2) calculate the new degree and cardinality if two columns and rows are added; and (3) write SQL queries to display records by price range, in descending price order, and insert a new row.
The document contains two questions about Python programming and SQL queries.
Question 1 asks students to write Python programs to: (1) create a new list with corresponding positive, negative, or zero values based on another list; and (2) create a new dictionary removing any keys with duplicate values from an existing dictionary.
Question 2 asks students to: (1) identify the primary key of a SQL table; (2) calculate the new degree and cardinality if two columns and rows are added; and (3) write SQL queries to display records by price range, in descending price order, and insert a new row.
The document contains two questions about Python programming and SQL queries.
Question 1 asks students to write Python programs to: (1) create a new list with corresponding positive, negative, or zero values based on another list; and (2) create a new dictionary removing any keys with duplicate values from an existing dictionary.
Question 2 asks students to: (1) identify the primary key of a SQL table; (2) calculate the new degree and cardinality if two columns and rows are added; and (3) write SQL queries to display records by price range, in descending price order, and insert a new row.
Create another List B with the help of corresponding (8)
elements of List A, i.e., if A[n] is zero, B[n] should also be zero, if A[n] is positive, B[n] should be 1 and if A[n] is negative, B[n] should be -1. Display the both Lists A and B. For example: If the content of the List A is – [45, 0, -4, 6, -3, -34] Then the content of the B should become – [1, 0, -1, 1, -1, -1] OR Write a Python program to create a dictionary of students where name is the key, marks is the value. Create another dictionary from the existing one after removing keys containing duplicate values from the given dictionary. For example: If the dictionary is: {‘Amit’: 12, ‘Sim’: 10, ‘Bhawna’: 12, ‘Hari’:13} New dictionary: {‘Amit’: 12, ‘Sim’: 10, ‘Hari’:13} (B) Some educational institutes use programming as a tool to measure knowledge level, abilities and/or skills of their pupils either on a general level or in a specific field of study. The IT instructor of Genius Academy has given the following questions to his students based on list manipulations. Help them solve these. Write the output of the following: (i) str = ‘computer’ print(list(str)) (ii) L=[2, 3, 4, 3, 5, 6, 3, 7, 3, 6, 8] C=L.count(3) print(C) (iii) L=[‘P’, ‘Y’, ‘T’, ‘H’, ‘O’, ‘N’] print(L.pop()) (iv) L1 = [20, 40, 30, 50] L2 = [6, 8, 9, 10] Print(L1+L2) Q2 Consider the following table name ‘SOFTDRINK’. (7) Table: SOFTDRINK DRINKCODE DNAME PRICE CALORIES 101 Lime and Lemon 25.00 120 102 Apple Drink 20.00 120 103 Nature Nectar 18.00 115 104 Green Mango 15.00 140 Based on the data given above, answer the following questions: (i) Identify the most appropriate column which can be considered as Primary Key. (ii) If two more columns and rows are added in the table SOFTDRINK, what will be the new degree and cardinality of the above table? Write SQL command or query for the following: (i) Display DRINKCODE, DNAME with Price in the range of 15 and 20. (ii) Display details of all the records in descending order of their price. (iii) Insert a new row in the table with data as (105, Mango Juice Bahaar’) Note: Student should use their own name, class and rollno to create a new database. For example, if student’s name is Ramesh, studying in 11-B and the rollno is 42, then name of the database will be Ramesh11B42.