1) Write a program for beautificaion (proper indentation) of a program file in an IDE.
ex:
int main(){
if(i<10){if(i>10)
prinf("Hi");else{};
}else{}
return 0;
}
You are provided with getToken() which returns a token
ex: if(i>10) is a token
int main() is a token
{,} are tokens
so output should be
int main()
{
if(i<10)
{
if(i>10)
printf("hi");
else
{
}
}
else
{
}
return 0;
}
void beautify(char* inputfile,char* outputfile)
Give some testcases for the above program
2) Write a program to find the diameter of a binary tree and then he wanted to extend it for m-ary tree.
1) You are provided with a string which contains single byte as well as two byte characters. If a character is single byte char, it’s MSB is 0, if it’s a 2 byte char, it’s MSB is 1. Write a program to check whether the given string is palindrome or not.
Test cases for above program.
1) Write a program to Validate an IPv4 Address.
Write test cases for above program.
Write a code for printing last n lines in a file (refer man page of tail command in linux). The file size may vary, it may be 1MB or it may be 100 GB.
Give top 10 test cases for the above program