Junior programmer Interview Questions | Glassdoor.co.in

# Junior programmer Interview Questions

1,725

junior programmer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

17 Apr 2018
hai

4 Oct 2017

### Junior Software Engineer at Pratian Technologies was asked...

15 Jun 2015
 write a program to print the given series (user need to enter the nth series number from keyboard) 2,3,5,11,23,29,41,53,83,89 .....n11 Answersimport java.util.Scanner; public class prg2 { public static void main(String[] args) { //2,3,5,11,23,29,41,53,83,89 .....n int i,count=0,n,j,flag,x=0; System.out.println("Enter number of term:"); Scanner sc=new Scanner(System.in); n=sc.nextInt(); for(i=2;true;i++){ flag=1; for(j=2;j<=i/2;j++){ if(i%j==0){ flag=0; break; } } if(flag==1){ ++count; if(count%4!=0){ System.out.println(i); ++x; } } if(x==n) break; } } }import java.util.Scanner; public class Series2 { static Boolean prime(int p) { for(int i=2; iwhat's the logic?Show more responses#include main() { int i,k,n,m,count=0; scanf("%d",&n); for(i=2;i<=n;i++) { for(k=0;k<=i;k++) { if((i%k==0)) count++; } if(count==2) m=2*i+1; count==0; for(k=0;(m!=0)&&(k<=m);k++) { if((m%k==0)) count++; } if(count==0) printf("%d",m); } }#include main() { int i,n,p,k,count=0,plus=0; printf(:enter the no\n"); scanf("%d",&n); for(i=2;i#include int prime(int num) { int i,c=0; for(i=2;iAnswer is in java :100% correct public class ProgramDemo { public static void main(String[] args) { System.out.println("Enter the value :"); Scanner read = new Scanner(System.in); int number = read.nextInt(); for(int i=2;i<=number;i++){ if(Prime(i)){ if(Prime(2*i+1)){ System.out.print(" "+i); } } } } static boolean Prime(int a) { int temp, c; for (c = 2; c <= a - 1; c++) { temp = a % c; if (temp == 0) { return false; } } if (c == a) { return true; } return false; } } I Hope its helpful for you :) Plese give me one like for it ....Excellent broimport java.util.Scanner; public class HelloJava { public static void main(String args[]) { int i,flag=0; for( int x = 2 ;x<100 ;x++) { flag=0; for(i=2;i<=x-1;i++) { if(x%i==0) { flag = 1; break; } } if(flag==0) { for( i = 2; iCan anyone please explain the logic?#include #include void main() { int i; printf("Enter no. of terms \n"); for(i=2; i<=50 ; i= 2*i+1) { printf("\n %d", i); } return 0; }

### Junior Programmer at Ubisoft was asked...

14 Jul 2017
 How to check if a number is divisible by 16 without using operator / or % ?8 Answersshould do using bit-wise operatorsI will run a loop that'll subtract 16 from the number. If result is zero than it is divisible else if it goes less than zero than its is not.Bit wise right shift four times, if integer then divisible.Show more responsesfor(int i=0;in) { break; } //number is not divisible by 16 //which will be decided by the flag } }Sorry for that incompleted answer ! I want to say that simply use a loop upto n and multiply each number with 16 and store in a variable and then go for a check if it is matched by n or not. If matched then flag==true else break;If a number is divisible by 2^n, do bitwise right shift n times and then bitwise left shift n times to get back the same number.if(16>>4 == 0 ) True; else FalseThe above condition should be 1 instead of 0. if(16>>4 == 1 ) True; else False

### Junior Java Developer at Naaptol was asked...

20 Dec 2017
 question mostly about output prediction of java code 5 Answersthey have already started conducting interviewsCan I know starting date pleaseWas it only for profound studentsShow more responsesHow many were shortlisted for the next round..??I have attended third round. That was horrible

### Junior Programmer at Ubisoft was asked...

14 Jul 2017
 How to check if a number is even or odd without using % or / ?4 Answersperform bitwise AND of given number with 1 and check the last bit if it is zero then number is even and if it is 1 then number is oddHow if we subtract 2 from given number while x>0. set flag=1 in while loop if x==0 found and break the while loop. Like this : int main() { int x,flag=0; cin>>x; do { x=x-2; if(x==0) { flag=1; break; } }while(x>0); if(flag==1) { cout<<"Even"; } else {cout<<"ODD";} return 0; }#include using namespace std; int main() { int n; cout>n; bool flag=false; //lets do the logic //1.even/odd logic for(int i=2;in) { break;//break the loop for time complexity } } } if(flag) { cout<<"It is even number"<Show more responsesint num; cout > num; if ((1 & num) == 1) { cout << "Odd \n"; } else { cout << "Even \n"; }

### Junior Software Engineer at People Tech Group was asked...

25 Sep 2014
 Describe yourself in three words.4 AnswersConfident Conscientious DiligentI am very interested in learningI am very interested in learningShow more responsesI am very interested in learning

### Junior Software Engineer at Diaspark was asked...

26 Jun 2012
 4 _?_ 4 _?_ 4 = 20 Put the proper operators to get the output.6 Answers4*6+4-4-4Only 4's are there....no six... and you can't add more 4... its like 4 ___4___4 = 20 Now play with the operators....Show more responses4+4-4*4+4Answer is Simple. 4*4+4=20 according BODMAS Rule. we can see that Addition will perform after the multiplication One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

### Junior Software Engineer at Worksbot was asked...

17 May 2019
 what is your parents dream? how you are going achieve that dream?4 AnswersMy parents dream, i want to become a engineer and be settle in good company.Every parents dreams also same as my parent dream I got a good company with enough salaryTechnical questions are based on which topics?Show more responsesTechnical questions based on which topics?

### Junior Software Engineer at Pratian Technologies was asked...

26 Dec 2016
 write a program to print the given series (user need to enter the nth series number from keyboard) 2,3,5,11,23,29,41,53,83,89 .....4 Answers#include #include int isPrime(int n) { int k; for( k=2;k<=sqrt(n);k++) if(n%k==0) return 0; return 1; } int main() { int k; int n; scanf("%d",&n); for(k=2;k<500;k++) { if(n==0)break; if(isPrime(k) && isPrime(2*k+1)) { printf("%d ",k); n--; } } return 0; }import java.util.Scanner; /** * * @author AndroidFarook */ public class Writtenexample1 { public static void main(String args[]) { Scanner in=new Scanner(System.in); System.out.println("Enter limit:"); int n=in.nextInt(); int count; for(int i=1;i<=n;i++) { count=0; int k=2*i+1; for(int j=2;j<=i/2;j++) { if(i%j==0 || k%j==0) { count++; break; } } if(count==0) { System.out.println(i); } } } }I didn't understand the answer above..Show more responsesEasy logic.... Prime numbers are not divided by 2 right?... So generate a condition if (i%2!==0) then print i
110 of 1,725 Interview Questions