0% found this document useful (0 votes)
12 views

tcl test

Uploaded by

aishwaryap0623
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)
12 views

tcl test

Uploaded by

aishwaryap0623
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
You are on page 1/ 4

1.

Write a TCL script that reads a file, processes its contents line by line, and appends each line to a
new file with line numbers.

2.Create a TCL script that takes user input to define a custom command using the "proc" command,
then execute the defined command.

3.Write a TCL script that reads a CSV file, converts the data to a list of dictionaries, and performs data
manipulation operations (e.g., filtering, sorting).

4.Create a TCL script that calculates the factorial of a given integer using recursion.

5.Implement a TCL program that converts a given date string in one format (e.g., "YYYY-MM-DD") to
another format (e.g., "MM/DD/YYYY").

6.Write a TCL script that merges two sorted lists into a single sorted list without duplicates, using list
operations only.

7.Develop a TCL program that takes a list of integers and computes the sum of all prime numbers in
the list.

8.Create a TCL script that flattens a nested list, converting it into a one-dimensional list.

9.Write a TCL program that validates an email address based on a regular expression, ensuring it
meets common email format criteria.

10.Develop a script that reverses a sentence while keeping the words in their original order (e.g.,
"Hello, world!" becomes "!dlrow ,olleH").
11.Create a TCL program that counts the number of occurrences of a specified word in a given text
string.

12.Implement a TCL script that finds the intersection of two arrays, preserving the common key-value
pairs.

13.Write a TCL program that generates a frequency distribution of words in a given text, storing the
results in an array.

14.Create a script that takes a list of dictionaries with 'name' and 'age' fields, and sorts them by age
in ascending order.

15.Develop a TCL program that combines two dictionaries with non-overlapping keys into a single
dictionary.

16.Write a script that calculates the average of values in a dictionary and stores the result in a new
key-value pair.

17.Create a TCL program that recursively searches for a key within nested dictionaries and returns its
value.

18.Write a TCL script that computes the greatest common divisor (GCD) of two numbers using a user-
defined procedure.

19.Develop a script that recursively generates all permutations of a given list, storing them in a list of
lists.
20.Create a TCL program that defines a procedure to find the roots of a quadratic equation and
handles complex solutions.

21.Implement a TCL script that uses a "for" loop to generate the Fibonacci sequence up to a specified
number of terms.

22.Create a program that repeatedly prompts the user for input until a valid date is provided (using
regular expressions for validation).

23.Write a script that uses "fileevent" to monitor a file and trigger a custom action when specific text
is appended to the file.

24.Develop a TCL program that recursively traverses a directory tree, listing all files with their sizes
and modification dates.

25.Create a script that reads a binary file, extracts specific data, and decodes it based on a custom
format specification.

26.Implement a TCL program that redirects both standard output and standard error to separate log
files for an external command execution.

27.Write a script that extracts all phone numbers from a text, considering variations like hyphens,
dots, and parentheses.

28.Create a program that validates a URL based on a regular expression, ensuring it adheres to
common URL format standards.
29.Develop a TCL script that finds and highlights all occurrences of a specified word in a text,
preserving the original case.

30.Write a TCL script that parses a text file containing a list of phone numbers, extracts the numbers
in a specific format (e.g., (123) 456-7890), and reformats them to a different standard (e.g., 123-456-
7890) using regular expressions.

You might also like