0% found this document useful (0 votes)
85 views1 page

Class XII Computer Science Programs

Uploaded by

anilperfect
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views1 page

Class XII Computer Science Programs

Uploaded by

anilperfect
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Practical Program List for Class XII Computer Science (083)

1. Program to enter two numbers and print the arithmetic operations


like +,-,*, /, // and %.
2. Write a Program to check if the entered number is Armstrong or not.
3. Write a Program to find factorial of the entered number.
4. Write a Program to enter the number of terms and to print the
Fibonacci Series.
5. Write a Program to show the outputs based on entered list.
6. Write a Program to enter the numbers in a list using split () and to
use all the functions related to list.
7. Write a Program to find factorial of entered number using user-
defined module fact().
8. Write a Program to read data from data file and show Data File
Handling related functions utility in python.
9. Write a Program to read data from data file in append mode and use
writeLines function utility in python.
10. Write a Program to read data from data file in read mode and
count the particular word occurrences in given string, number of
times in python.
11. Write a Program to show MySQL database connectivity in
python.
12. Write a Python program to implement all basic operations of a
stack, such as adding element (PUSH operation), removing element
(POP operation) and displaying the stack elements (Traversal
operation) using lists.
13. Write a program to display unique vowels present in the given
word using Stack.
14. Write a program in Python to add, delete and display elements
from a queue using list.
15.

Common questions

Powered by AI

The recursive approach calculates the factorial of a number by defining a base case where the factorial of 0 or 1 is 1, and for any other number n, the factorial is n multiplied by the factorial of n-1. This method involves multiple function calls, leading to increased memory usage due to stack space being consumed for each recursive call, particularly noticeable for large n .

The program likely employs an iterative approach to generate the Fibonacci series, which significantly reduces time complexity compared to a naive recursive approach. Iteration avoids repeated calculations and uses a loop to compute each term which depends on the values of the two preceding terms, resulting in an efficient O(n) time complexity .

The Python program uses basic arithmetic operators like +, -, *, /, //, and %. The + operator is used for addition, - for subtraction, * for multiplication, / for division resulting in a float, // for floor division which results in an integer, and % for modulus operation which gives the remainder. Each operation may involve converting inputs to compatible data types, typically integers or floats, to perform calculations efficiently .

Using user-defined modules for operations like factorial calculation promotes modular programming, reusability, and easier debugging. Educationally, it fosters a deeper understanding of program architecture and function, while practically, it allows for organizational clarity and the separation of concerns, making codebases easier to maintain and scale .

The program checks if a number is an Armstrong number by breaking the number into its digits, raising each digit to the power of the number of digits, and summing up those values. It then compares this sum to the original number. The computational complexity of this method is O(n), where n is the number of digits in the number .

The program uses a stack to push each vowel identified in the given word if it hasn’t been encountered before. This ensures that only unique vowels are stacked, and the stack structure helps manage data in a LIFO manner, facilitating easy access to the latest unique values. This relevance lies in its ability to efficiently track and manage unique elements by leveraging stack operations .

Implementing a queue using Python lists allows for straightforward addition (enqueue) and removal (dequeue) of elements. However, while appending items at the list's end has an average complexity of O(1), removing the first element (dequeue) involves shifting all subsequent elements, resulting in an O(n) time complexity. Thus, while simple, this approach can become inefficient with larger datasets .

Using lists for implementing stack operations like push, pop, and traversal is efficient due to the dynamic nature of lists in Python, which allow for O(1) average complexity push and pop operations at the end of the list. This promotes an efficient runtime behavior for stack operations with minimal overhead, making it suitable for applications needing frequent last-in-first-out data handling .

In append mode, the writeLines function is used to add additional lines to an existing file without deleting its current content. This function is significant because it allows continuous data recording while preserving historical data, essential for applications that require updating logs or databases incrementally .

Reading a file in append mode allows the program to add content to the end of the file without altering the existing data, while reading in read mode allows only to view and read the contents without making any modifications. The choice between these modes affects whether the program's functions modify the file or just display its contents, with append affecting write operations and read mode being non-destructive .

You might also like