JavaRush /جاوا بلاگ /Random-SD /هڪ انٽرويو ۾ منطقي مسئلا
Юрий Кузнецов
سطح
Москва

هڪ انٽرويو ۾ منطقي مسئلا

گروپ ۾ شايع ٿيل
توهان کي مون کان 5 منطقي مسئلن ۽ 4 جاوا مسئلن جو تجزيو ڪرڻو پوندو. انٽرويو دوران جيڪي مسئلا پيش آيا ۽ انهن جا حل انٽرنيٽ تي موجود آهن. مان انهن جي مٿين لسٽ ڏيندس جن کي مون انٽرويو دوران منهن ڪيو. هڪ انٽرويو ۾ منطقي مسئلا - 1
  1. ٽوپي ۾ چار ماڻهو

  2. هڪ پل ۽ ٽارچ جي باري ۾ مسئلو

  3. 9 سکن مان، ھڪڙو جعلي آھي: اھو ھلڪو آھي. ان کي ترازو تي ٻن وزنن ۾ ڪيئن ڳولهجي؟

  4. اڳئين مسئلي وانگر لڳ ڀڳ ساڳيو، صرف ترازو ڪو به ٿي سگهي ٿو. مسئلو "ٻلين جا 5 جار" .

  5. "لامتناڪ ٽرين"

انٽرويو دوران پڇيا ويا سوالن کي ڍڪڻ لاء:

  1. جاوا ۾ سنگلٽن کي لاڳو ڪرڻ جا ڪيترائي طريقا لکو.

  2. هن ڪوڊ ۾ ڇا ٿيندو؟

    هڪ انٽرويو ۾ منطقي مسئلا - 2
    class MyExc1 extends Exception{}
    class MyExc2 extends Exception{}
    class MyExc3 extends Exception{}
    
    public class Test {
        public static void main(String[] args) throws Exception {
            try {
                System.out.print(1);
                p();
            }catch (MyExc2 e){
            }
            finally {
                throw new MyExc3();
                System.out.print(2);
            }
        }
        public static void p() throws Exception {
            try {
                throw new MyExc1();
                 } catch (MyExc1 myExc1) {
                throw new MyExc2();
            }finally {
                System.out.println(3);
            }
        }
    }
  3. مون کان مسئلو، ڇو ته مون کي ياد ناهي ته ڪهڙو مثال هو

    public class Test {
        public static void main(String[] args)  {
            String s = "Hello";
            String s1 = "Hello";
            String s2 = new String("Hello");
    
            System.out.println(s == s1);
            System.out.println(s1 == s2);
    
            Integer i = 111;
            Integer i1 = 111;
            Integer i2 = new Integer(111);
            Integer i3 = new Integer(111);
    
            Integer i4 = -129;
            Integer i5 = -129;
            Integer i6 = new Integer(-129);
    
            System.out.println(i == i1);
            System.out.println(i1 == i2);
            System.out.println(i2 == i3);
    
            System.out.println(i4 == i5);
            System.out.println(i5 == i6);
    
            System.out.println(i6 == -129);
        }
    }
  4. پروگرام هلائڻ جو نتيجو ڇا ٿيندو؟ ۽ جيڪڏھن اسان آخري ٻن لائينن کي غير تبصرو ڪريون ته اسان کي ڪھڙو نتيجو ملندو؟

    class Test{
        private int id;
        private Integer id2;
    
        public Test(int id, Integer id2) {
            System.out.println("Создаем екзепляр Test");
            this.id = id;
            this.id2 = id2;
        }
    
        public Integer doIt(){
            return id + id2;
        }
    }
    class Test1{
        private Test test;
        private static int i;
    
        public Test1() {
            System.out.println("Создаем екзепляр Test1");
            this.test = new Test(i, 10);
        }
        public Test getTest() {
            return test;
        }
    }
    
    class Main {
        public static void main(String[] args)  {
            Test1 test1 = new Test1();
            System.out.println(test1.getTest().doIt());
           // Test test = new Test(null, 1);
           // test.doIt();
        }
    }
    هڪ انٽرويو ۾ منطقي مسئلا - 3
PS: منطقي مسئلن جا جواب سڀ انٽرنيٽ تي ملي سگھن ٿا. انهن دلچسپين لاءِ، مان ڳنڍي رهيو آهيان پوئين پوسٽ جاوا ڊولپر جي انٽرويو بابت
تبصرا
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION