TCS PRA JAVA Question with Solution | FULL EXPLANATION | TCS IRA Solutions | TCS CPA JAVA SOLUTIONS

Поделиться
HTML-код
  • Опубликовано: 2 фев 2025

Комментарии • 52

  • @amazingfactosofficial
    @amazingfactosofficial 9 месяцев назад

    Bro ye jo parameterized constructor,getters and setters k liye jo shortcut use kiye ho double shift wo PRA exam me kr skte waisa??
    PLEASE REPLY

  • @Creative_Mind226
    @Creative_Mind226 2 года назад

    Can you help me to solve the error of input miss matched
    I have just the the this code still error of input miss matched showed

  • @vipulmahajan2513
    @vipulmahajan2513 2 года назад +1

    Sir in this question in the place of finding maximum age of student if we want to find total age of jisha and Eva so how to do that because in place of Max we have to take string as well as age sir its my request please let me know how to do that .

  • @robinsharma3160
    @robinsharma3160 Год назад +1

    Bro can we do it by inter max=integer_min.. U have explained in 1 video for maximum value

  • @shwetakumari82
    @shwetakumari82 2 года назад

    Sir when try to run this I got the error msg like non static variable cannot be referenced from a static contex

    • @shwetakumari82
      @shwetakumari82 2 года назад

      How resolve this error please reply sir

  • @bibhuduttanayak8189
    @bibhuduttanayak8189 2 года назад +2

    Please provide more content for upcoming batches ...like 2023 batch

  • @tanyagupta6319
    @tanyagupta6319 2 года назад

    We can solve questions in c++ language in tcs ira?

  • @utkarshsrivastava7564
    @utkarshsrivastava7564 2 года назад

    brother i used your methode, program to compile ho gya but test cases run ni ho rhe,kya kru?

  • @yupp_harish3936
    @yupp_harish3936 Год назад

    2nd loop.leke.complex.krdiye

  • @arkomukherjee7712
    @arkomukherjee7712 2 года назад +1

    Thanks yaar so much ... this question has repeated on pra 24th May

  • @amolkhiste8302
    @amolkhiste8302 2 года назад

    Bro. I get an exception in "main" Java. Lang. NullpointeeEception
    So what I do..

  • @nothing-xr8sf
    @nothing-xr8sf 2 года назад

    Sir, which editor you are using.

  • @bibhuduttanayak8189
    @bibhuduttanayak8189 2 года назад +1

    Thanks a lot for explaining it in a easy way

  • @Sarinikurpa
    @Sarinikurpa 11 месяцев назад

    Very helpful sir

  • @smileyy8611
    @smileyy8611 Год назад

    Bro if the output is name instead of I'd then input will be 2
    String input2 = sc.nextLine( );
    Is it correct input for 2

  • @omkarvankundre99
    @omkarvankundre99 3 года назад

    I am getting an runtime error please tell me. What should I do

    • @SadikPathan
      @SadikPathan  2 года назад +2

      you can connect with me on linkedin.
      link to my linked in profile is given in the desciption of the videos on my channel.

  • @JAHNAVITBBTCS
    @JAHNAVITBBTCS 3 года назад +2

    Create a class called Student with the below attributes:
    rollNo - int
    name - String
    branch - String
    score - double
    dayScholar - boolean
    The above attributes should be private, write getters, setters and parameterized constructor as required.
    Create class Solution with main method.
    Implement two static methods -findCountOfDayscholarStudents and findStudentwithSecondHighestScore in Solution class.
    Can you give the solution for this?

    • @SadikPathan
      @SadikPathan  3 года назад +1

      Can you please provide whole question?
      I would like to know sample input and output as well.and also I would like to know description of 2 static methods.

    • @JAHNAVITBBTCS
      @JAHNAVITBBTCS 3 года назад +2

      @@SadikPathan Create a class called Student with the below attributes:
      rollNo - int
      name - String
      branch - String
      score - double
      dayScholar - boolean
      The above attributes should be private, write getters, setters and parameterized constructor as required.
      Create class Solution with main method.
      Implement two static methods -findCountOfDayscholarStudents and findStudentwithSecondHighestScore in Solution class.
      findCountOfDayscholarStudents:
      This method will take an array of Student objects as an input parameter . This method will calculate and return the count of Students whose score is greater than 80 and who are all from dayScholar.
      If no Student scored greater than 80 and from dayScholar are present in the array of Student objects, then the method should return 0.
      findStudentwithSecondHighestScore:
      This method will take an array of Student objects as an input parameter. This method will return the object of the second highest score student from the array of Student objects who are not from the dayScholar.
      If no Student is a dayScholar in the array of Student objects, then the method should return null.
      Note : All the searches should be case insensitive.
      The combination of dayScholar and score for each student is always unique.
      The above mentioned static methods should be called from the main method.
      For findCountOfDayscholarStudents method - The main method should print the returned count as it is if the returned value is greater than 0, else it should print "There are no such dayscholar students".
      For findStudentwithSecondHighestScore method - The main method should print the rollNo, name and score in the below format from the returned object if the retuned value is not null.
      rollNo#name#score
      If the returned value is null, then it should print ”There are no student from non day scholar”
      Before calling these static methods in main, use Scanner object to read the values of four Student objects referring attributes in the above mentioned attribute sequence.
      Consider below sample input and output:
      Input:
      1001
      Ashwa
      IT
      85
      true
      1002
      Preeti
      IT
      70
      false
      1003
      Uma
      ECE
      85
      false
      1004
      Akash
      EEE
      90
      true
      Output:
      2
      1002#Preeti#70.0
      --------------------------------------------------
      Sample code snippet for reference:
      Please use below code to build your solution.
      --------------------------------------------------
      import java.util.Scanner;
      public class Solution
      {
      public static void main(String[] args)
      {
      //code to read values
      //code to call required method
      //code to display the result
      }
      public static int findCountOfDayscholarStudents(/* required parameters to be added */)
      {
      //method logic
      }
      public static Student findStudentwithSecondHighestScore(/* required parameters to be added */)
      {
      //method logic
      }
      }
      class Student
      {
      //code to build the class
      }
      -------------------------------------------------
      Note on using Scanner object:
      Sometimes scanner does not read the new line character while invoking methods like nextInt(), nextDouble() etc.
      Usually, this is not an issue, but this may be visible while calling nextLine() immediately after those methods.
      Consider below input values:
      1001
      Savings
      Referring below code:
      Scanner sc = new Scanner(System.in);
      int x = sc.nextInt();
      String str = sc.nextLine(); -> here we expect str to have value Savings.Instead it may be "".
      If above issue is observed, then it is suggested to add one more explicit call to nextLine() after reading numeric value.

    • @SadikPathan
      @SadikPathan  3 года назад

      The video is uploaded on my channel jahnavi.kindly watch it because I have discussed your problem in that video

  • @shravanikaira8611
    @shravanikaira8611 2 года назад

    but in exam ,we need to write program in notepad not this eclipse

    • @SadikPathan
      @SadikPathan  2 года назад

      Yes you need to write in editor and not ide .
      So you need to write constructor , getter and setter on your own.
      I am writing in ide because it helps me in writing code faster because it gives suggestions.

  • @gaminghubCR
    @gaminghubCR 3 года назад

    Bhai jese aapne bola getter bhi use kr skte ho but sirf I'd, name se kaam chalega to unka bnane ka mtlb kya h code m faltu time waste h. Agr esa h to phir setter to khi use hi nhi hue to itna time kyu waste kre code likhne m

    • @SadikPathan
      @SadikPathan  3 года назад

      Agar name ,id,age,marks attributes ko private
      Declare kar diya,to hum id ,marks age ,marks ko directly access nahi karsakte(students[i].id will not work, but students[i].getId() will work because getId() method is public .).us case me hame getter and setters ki jarurat paddti hai .
      Class me agar koi attribute ya fir method private hai to usko hum getters and setters se hi access kar sakte hai. Lekin maine jo class banayi hai ,usme koi bhi attribute private nahi hai ,isliye mai id ko
      ans1.id likhke access kar paa raha hu aur ans1.getId() likhke bhi access kar paa raha hu.
      I hope you understand.

    • @gaminghubCR
      @gaminghubCR 3 года назад

      Okk smjha lekin agr exam me attribute private krne bole or hm na krr to test case pass nhi honge?

    • @SadikPathan
      @SadikPathan  3 года назад +1

      Agar private karne ko bola fir bhi mat karo private .aur getter setter bhi mat likho.time waste hota hai.
      Aise maine kiya tha ,fir bhi test cases pass ho gye the.

  • @anshuman729
    @anshuman729 2 года назад

    thank u so much bro . i have pra

  • @gaminghubCR
    @gaminghubCR 3 года назад

    Or brother 20 Dec ko IRA EXAM hua tha uska solution nhi de rhe aap? Esa kyu

    • @SadikPathan
      @SadikPathan  3 года назад

      Aane vale saturday ko bana dunga bro vo bhi.👍

  • @himanibhise394
    @himanibhise394 2 года назад

    Can u tell ans for 2aug pra? Plz

  • @shivanshgoyal310
    @shivanshgoyal310 2 года назад +1

    Thankyou so much!!!!!

  • @saisrujana3244
    @saisrujana3244 3 года назад

    bro is this code run in java7 or java8?

  • @VaibhavSingh-qi5cz
    @VaibhavSingh-qi5cz 3 года назад

    Thank you 😇🤘

  • @indrajitbhandare9533
    @indrajitbhandare9533 2 года назад +1

    Well explained

  • @bhavaninidumolu9915
    @bhavaninidumolu9915 3 года назад

    Pyton code explanation plz

    • @SadikPathan
      @SadikPathan  2 года назад

      I am much more comfortable with java as compared to python.

  • @JAHNAVITBBTCS
    @JAHNAVITBBTCS 2 года назад

    Good Evening Sir. Can you provide solution for the below question sir?
    Question 1 :
    Create a Class Player with below attributes:
    id - int
    country - String
    side - String
    price - double
    Write getters, setters and parameterized constructor as required.
    Create class Solution with main method.
    Implement static method - searchPlayerForMatch in Solution class.
    This method will take a String parameter along with the other parameter as array of Player objects.
    The method will return array of Player where the String parameter appears in the side attribute (with case insensitive search).
    This method should be called from main method and display the id of returned objects in ascending order.
    Before calling this method(searchPlayerForMatch) in the main method, use Scanner object to read values for four Player objects referring the attributes in the above sequence.
    then, read the value for search parameter.
    Next call the method searchPlayerForMatch, write the logic to sort the id in ascending order (in main method) and display the result.
    Consider below sample input and output:
    Input:
    1
    India
    Batting
    2500000
    2
    Australia
    Batting
    1000000
    3
    Srilanka
    Bowling
    1700000
    4
    England
    Bowling
    2000000
    Batting
    Output:
    1
    2
    --------------------------------------------------
    Sample code snippet for reference:
    Please use below code to build your solution.
    --------------------------------------------------
    public class Solution
    {
    public static void main(String[] args)
    {
    //code to read values
    //code to call required method
    //code to display the result
    }
    public static Player[] searchPlayerForMatch(String search, Player[] players)
    {
    //method logic
    }
    }
    class Player
    {
    //code to build Player class
    }
    -------------------------------------------------
    Note on using Scanner object:
    Sometimes scanner does not read the new line character while invoking methods like nextInt(), nextDouble() etc.
    Usually, this is not an issue, but this may be visible while calling nextLine() immediately after those methods.
    Consider below input values:
    22
    hello
    Referring below code:
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    String str = sc.nextLine(); -> here we expect str to have value hello. Instead it may be "".
    If above issue is observed, then it is suggested to add one more explicit call to nextLine() after reading numeric value.

    • @SadikPathan
      @SadikPathan  2 года назад

      Can you please tell me in which exam and when this question was asked?

    • @JAHNAVITBBTCS
      @JAHNAVITBBTCS 2 года назад

      @@SadikPathan Sir it is in TCS IPA exam but I'm unaware of which year sur

    • @SadikPathan
      @SadikPathan  2 года назад

      @@JAHNAVITBBTCS the video is out on my channel .
      Please watch it as i have discussed your problem.

    • @JAHNAVITBBTCS
      @JAHNAVITBBTCS 2 года назад

      @@SadikPathan Thank you so much sir!

  • @yashdua2674
    @yashdua2674 2 года назад

    veryy helpful

  • @akshathole6641
    @akshathole6641 Год назад

    Thank you so much!