Skip to main content

Posts

TCS Xplore 2023 ( iON proctored Assessment ) - MCQ on Unix with clear concept

                    Unix ( Multiple Choice Quistion )  1.  Which Symbol be used with grep command to match the the pattern pat at the beginning of a line ?          a. ^pat         b. $pat         c. pat$         d. pat^ Correct Answer : a Explantion :  Matching the lines that start with a string : The ^ regular expression pattern specifies the start of a line. This can be used in grep to match the lines which start with the given string or pattern. $ grep "^unix" file.txt 2. Which command is used to sort the lines of a data in a file in reverse order ?            a.  sort             b. sh            c. sort-r            d. st            e. None of the above  Correct Answer : ...

TCS Xplore 2023 Ion Proctored Exam ( IPA) 7 - JAVA coding solution ( 35 marks )

 Problem Statement :  Subscribe Please :   click here           Subscribe Please :   click here                          Create a class Course with the below attributes: String courseName; String instructor; int studentAttend; boolean present; String city ; Write getters, setters for the above attributes . Create constructor which takes parameter in the above sequence . Create class Solution with main method. Implement one static methods – findCategory in Solution class.                                                       Subscribe Please :   click here findCategory method :  This method will take two input parameters -array of Course objects and string parameter name i.e courseName. The method will return the the String value th...

TCS Xplore 2023 Ion Proctored Exam ( IPA) 6 - JAVA coding solution ( 35 marks )

 Problem Statement : Write a java program in which - 1. declare a class Beach and make attributes as -         int - BeachId , String - BeachName , String Location , String type , int rating ,int avg person come  and along with the constructor . All the attribute should be private and implement their  getter and setter . 2.  Write a Solution class with main method . where you have to implement a static method findLeastRating where you have to pass array object along with the String and an integer value which you have to take form user .( where String refers to location and int refers to number of person come ) 3. in findLeastRating method , you have to implement that if  location of any array object matches with the given String value of location and avg number of person come is greater than integer value that is taken from user then print the rating which is least one . and there is no any value get then it simply returns 0 and display on sc...

TCS Xplore 2023 Ion Proctored Exam ( IPA) 6 - JAVA coding solution ( 15 marks )

 Problem Statement :   Subscribe Please :   click here           Subscribe Please :   click here   Write a program to take a integer  number and check whether this number is perfect number or not . if number is perfect then print "Given number is Perfect number" else print  "Given number is not Perfect number". A number whose  sum of factors  (excluding the number itself) is equal to the number is called a  perfect   number . In other words, if the sum of positive divisors (excluding the number itself) of a number equals the number itself is called a  perfect number .                                           Subscribe Please :   click here   Example :  First, we find the factors of 496 i.e.  1, 2, 4, 8, 16, 31, 62, 124,  and  248 . Let's find the sum of f...

A Series on "JAVA CODING CHALLENGE" #2 Palindrome Check for String and Number both

Problem 2 :  Subscribe Please :   click here              Subscribe Please :   click here Write a program to check whether a String or Number is Palindrome or Not . Example : String : "madam" is Palindrome and "mad" is not                    Number : 121212 is Palindrome but 123 is not .  Subscribe Please :   click here                       Subscribe Please :   click here Approach :   Get the number to check for palindrome Hold the number in temporary variable Reverse the number Compare the temporary number with reversed number If both numbers are same, print "palindrome number" Else print "not palindrome number" Code :  import java . util .*; public class Palindrome {     public static void main ( String [] args ) {         Scanner sc = new Scanner ( System . in )...

A Series on "JAVA CODING CHALLENGE" #1 Reverse a Number

 Problem 1 :  Subscribe Please :   click here                 Subscribe Please :   click here Write a program to reverse a number . Example : if a number is 12345 the it's output will be 54321 .  Approach : Taking a integer value from user and applying the logic and print the output .  Subscribe Please :   click here              Subscribe Please :   click here Code : import java . util . Scanner ; public class Reverse {     public static void main ( String [] args ) {         Scanner sc = new Scanner ( System . in );         System . out . println ( "Enter a number : " );         int num = sc . nextInt ();         System . out . println ( "Reverse of Number : " );         while ( num != 0 ){             int d = num % 1...

TCS Xplore 2023 Ion Proctored Exam ( IPA) 5 - JAVA coding solution ( 35 marks )

 Problem Statement :                               Subscribe Please :   click here Write a java program in which - 1. declare a class Vegetables and make attributes as -         int - vegetableId , String vegetableName , int price , int rating  and along with the constructor . All the attribute should be private and implement the getter and setter . 2.  Write a Solution class with main method . where you have to implement a static method findPrice where you have to pass array object along with the rating which you have to take form user . 3. in findPrice method , you have to implement that if the rating of vegetable is greather than the rating that user has given then return that vegetable object as output which has minimum rating or if no any vegetables are present which satisfy the above condition then simply print "No Match Found". 4. if it any return any object the...