IP Class 11 Tutorial

Differentiate between Primary key and Foreign key

Primary Key Foreign Key It identifies the each record in a table uniquely. It maintains the relation between two tables. A foreign key is primary key in another related table. A table can have only one Primary key. A table can have more than one Foreign key. Primary key cannot have NULL values. Foreign key […]

Differentiate between Primary key and Foreign key Read More »

Why foreign keys are allowed to have NULL values? Explain with an example.

Foreign Key is used to represent the relation between two tables. Because in the field with Foreign key attribute data comes from Primary key field in another related table and so Foreign key are allowed to have Null Values if it not the part of Primary key field of the related table. For example- Here

Why foreign keys are allowed to have NULL values? Explain with an example. Read More »

1. Give the terms for each of the following:
Collection of logically related records.

a) Collection of logically related records.b) DBMS creates a file that contains description about the data stored in the database.c) Attribute that can uniquely identify tuples in a relationd) Special value that is stored when actual data value is unknown for an attribute.e) An attribute which can uniquely identify tuples of the table but is

1. Give the terms for each of the following:
Collection of logically related records.
Read More »

What is the difference between else and elif construct of if statement?

To implement conditions in a program we always use if statement. We can use single if statement or multiple if statement as per our situation. When we want to implement multiple if statement than we use if…elif…else statement in python. Here ‘eleif’ is short form of ‘else if’ which is used in other languages. We

What is the difference between else and elif construct of if statement? Read More »

Write a program that asks the user to enter one’s name and age. Print out a message addressed to the user that tells the user the year in which he/she will turn 100 years old.

from datetime import datedates = date.today()name = input(“Enter your Name”)age = int(input(“Enter your Age”))diff = 100 – ageresult_year = dates.year + diffprint(“You will turn 100 years old in “, result_year)

Write a program that asks the user to enter one’s name and age. Print out a message addressed to the user that tells the user the year in which he/she will turn 100 years old. Read More »

Write a Python program to calculate the amount payable if money has been lent on simple interest. Principal or money lent = P, Rate = R% per annum and Time = T years.

P = int(input(“Enter Principal Amount or Money lent”))R= int(input(“Enter Rate of Interest”))T = int(input(“Enter Time Period”))SI = (P*R*T)/100amt = P + SIprint(“Amount Payable is = ” , amt)

Write a Python program to calculate the amount payable if money has been lent on simple interest. Principal or money lent = P, Rate = R% per annum and Time = T years. Read More »

Which data type will be used to represent the following data values and why?

a) Number of months in a year.b) Resident of Delhi or notc) Mobile numberd) Pocket moneye) Volume of a spheref) Perimeter of a squareg) Name of the studenth) Address of the student ANS: a) ‘int’ data type will be used because number of months is always an integer or whole number. b) ‘bool’ (boolean) data

Which data type will be used to represent the following data values and why? Read More »

error: Content is protected !!