Posts

TCL Interview Programs

Disclaimer – There are always multiple approaches to solve a problem. We have used only one out of those. You can try other logic based on your understanding. Please comment your concern to us, we may help you in your understanding on TCL Programmings. 1.        Write a program to print a string in TCL ? Ans –   Strings can be printed using double quotes, single quote or curly braces. Please refer the below example for trying dfferent variables. set a "TCL Programs" puts "$a" Output : tclsh main.tcl TCL Programs 2.        Write a program to accept two numbers from user and print their sum? Ans – puts "enter a number" set 1stnum [gets stdin] puts "enter another number" set 2ndnum [gets stdin] set result [expr $1stnum + $2ndnum] puts “Sum of both the numbers is $result” Output : tclsh main.tcl Enter a number 345 Enter another number 100 Sum of both the numbers is 445 3.  ...