By QB365 on 31 Dec, 2022
QB365 provides a detailed and simple solution for every Possible Questions in Class 12 Computer Science Subject - Important 2 Mark English Medium. It will help Students to get more practice questions, Students can Practice these question papers in addition to score best marks.
12th Standard
Computer Science
Answer all the following questions.
What is a subroutine?
What is a List? Give an example.
What is Mapping?
What is Sorting?
Write short notes on Tokens.
Write short notes on Exponent data?
Write note on break statement.
Write note on range () in loop.
Write the different types of function.
What is base condition in recursive function?
What is String?
How will you delete a string in Python?
What will be the value of x in following python code?
List 1 = [2, 4, 6[1, 3, 5]]
x = len (List 1)
Write the syntax of creating a Tuple with n number of elements.
What is instantiation?
How will you create constructor in Python?
List some examples of RDBMS.
What is normalization?
Differentiate Unique and Primary Key constraint
What is the difference between SQL and MYSQL?
Mention the default modes of the File.
What is the theoretical difference between Scripting language and other programming language?
What is the use of modules?
Mention the users who uses the Database.
Write the command to populate record in a table. Give an example.
List the types of Visualizations in Matplotlib.
Give an example of pure function.
Write a note on pair datatype
Write the output of the following program
a:=10
Disp():
a:=7
print a
Disp 1():
print a
Write a note on Big omega asymptotic notation.
Answers
(i) Subroutines are the basic building blocks of computer programs. Subroutines are small sections of code that are used to perform a particular task that can be used repeatedly.
(ii) In Programming languages these subroutines are called as Functions.
List is constructed by placing expressions within square brackets separated by commas. List can store multiple values.
Example:
1st := [10, 20]
x, y:= 1st
In the above example x will become 10 and y will become 20.
The process of binding a variable name with an object is called mapping = (equal to sign) is used in programming languages to map the variable and object.
Sorting is a method of arranging group of items in ascending or descending order. Various sorting techniques in algorithms are Bubble sort, Quick sort, Heap sort, Selection sort, Insertion sort.
Python breaks each logical line into a sequence of elementary lexical components known as Tokens. The normal token types are
(i) Identifiers,
(ii) Keywords,
(iii) Operators,
(iv) Delimiters and
(v) Literals.
An Exponent data contains decimal digit part, decimal point, exponent part followed by one or more digits.
The break statement terminates the loop containing it. Control of the program flows to the statement immediately after the body of the loop.
The range() is a built-in function, to generate series of values between two numeric intervals.
The syntax of range() is as follows:
range (start,stop,[step])
Where,
start - refers to the initial value
stop - refers to the final value
step - refers to increment value, this is optional part.
(i) User defined functions.
(ii) Built in functions.
(iii) Lambda functions.
(iv) Recursion functions.
(i) A recursive function calls itself.
(ii) The condition that is applied in any recursive function is known as base condition.
(iii) A base condition is must in every recursive function otherwise it will continue to execute like an infinite loop.
(i) String is a data type in python, which is used to handle array of characters.
(ii) String is a sequence of Unicode characters that may be a combination of letters, numbers, or special symbols enclosed within single, double or even triple quotes.
(iii) Example :
Welcome to learning Python"
"Welcome to learning Python"
""Welcome to learning Python""
Python will not allow deleting a particular character in a string. Whereas you can remove entire string variable using del command.
Example :
>>> strl="How about you"
>>> print (str1)
How about you
>>> del str1
>>> print (str1)
Traceback (most recent call last):
File "
print (strl)
NameError : name 'str1' is not defined
4
Syntax:
# Tuple with n number elements
Tuple_Name (E1, E2, E3.......En)
# Elements of a tuple without parenthesis
Tuple_Name = El, E2, E3 ................. En
Once a class is created, next to create an object or instance of that class. This process of creating object is called as "Class Instantiation".
(i) "Init" is a special function begin an end with double underscore in Python act as a Constructor .
(ii) Constructor function will automatically executed when an object is created.
General format of __init__ method
(Constructor function)
def __init__ (self, [args........])
<statements>
(i) SQL server
(ii) Oracle
(iii) MySql
(iv) Maria DB
(v) SQLite.
Database normalization was first proposed by Dr.Edgar F Codd as an integral part of RDBMS in order to reduce data redundancy and improve data integrity. These rules are known as E FCodd Rules.
S.No | Unique Key Constraint | Primary Key Constraint |
---|---|---|
(i) | This constraint ensures that no two rows have the same value in the specified columns. | This constraint declares a field as a Primary Key which helps to uniquely identify a record. |
(ii) | The UNIQUE constraint can be Create applied only to fields that have also been declared as NOT NULL. | The Primary Key does not allow NULL values. |
SQL | MYSQL |
Structured Query Language is a language used for accessing database | MySQL is a database | accessing databases. management system, like SQL Server, Oracle, Informix,postgres,etc. |
SQL is a DBMS | MySQL is a RDBMS |
The default is reading in text mode. In this mode, while reading from the file the data would be in the format of strings.
(i) The theoretical difference between the two is that scripting languages do not require the compilation step and are rather interpreted.
(ii) For example, normally, a C++ program needs to be compiled before running whereas, a scripting language like JavaScript or Python need not be compiled.
(iii) A scripting language requires an interpreter while a programming language requires a compiler.
Modular programming is a software design technique to split our code into separate parts. These parts are called modules. The focus for this separation should have modules with no or just few dependencies upon other modules.
Users of database can be human users or programmers, other programs or applications.
To populate the table "INSERT" command is passed to SQLite."execute" method executes the SQL command to perform some action.
Example:
Sql_command =" " INSERT INTO student (Rollno, Sname, Grade, Gender, Average, birth_date) values (NULL, "Akshay", "B", "M", "87.8", "2001-12-12");" " cursor.execute(sql_command)
(i) Line plot
(ii) Scatter plot
(iii) Histogram
(iv) Box plot
(v) Bar chart and
(vi) Pie chart
let square x
return: x * x
let i: = 0;
ifi < strlen> (s) then
-- Do something which doesn't affect s
++i
(i) A pair is a compound data type that holds two other pieces of data. The two ways of representing the pair data type.
(ii) The first way is using List construct and the second way to implement pairs is with the tuple construct.
The output of the program
7
10
Big Omega is the reverse Big O, if Big O is used to describe the upper bound (worst - case) of a asymptotic function, Big Omega is used to describe the lower bound (best-case).