Help and support on OCA OCP Java Programmer Certification Questions  
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817
	Moderator:  admin 
			
		
				
			
				
																			
								dheeraj426 							 
									
		Posts:  1 		Joined:  Fri Sep 08, 2017 9:02 am 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by dheeraj426   »  Fri Sep 08, 2017 9:07 am 
			
			
			
			
			What will the following code print? 
Code: Select all 
int x = 1; int y = 2; 
int z = x + +; 
int a = --y; 
int b = z--; 
b + = + + z; 
int answ = x > a? y > b? y:b:x > z? x:z; 
System.out.println( answ);
 
			
			
													
					Last edited by 
admin  on Fri Sep 08, 2017 10:29 am, edited 1 time in total.
					
Reason:  Update post to use [code] tags 				 
			
									
						 
		 
				
		
		 
	 
	 
				
		
				
			
				
																			
								admin 							 
						Site Admin 			
		Posts:  10443 		Joined:  Fri Sep 10, 2010 9:26 pm 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by admin   »  Fri Sep 08, 2017 10:29 am 
			
			
			
			
			What happened when you tried it out?
Also, please put code within 
.
 
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
				
			
				
																			
								Sergey 							 
									
		Posts:  39 		Joined:  Sat Jul 29, 2017 1:04 pm 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by Sergey   »  Tue Jan 09, 2018 12:51 pm 
			
			
			
			
			Code: Select all 
int answ = (x>a) ? (y>b ? y:b) : (x>z?x:z);
I did not resolve this question at the paper. As for me, it is extremely hard question.
 
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
				
			
				
																			
								OCAJO1 							 
									
		Posts:  221 		Joined:  Mon Nov 26, 2018 2:43 pm 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by OCAJO1   »  Thu Dec 13, 2018 9:17 pm 
			
			
			
			
			What would you say is good exam taking strategy for time consuming questions like this, figure them out, or leave them for the end?
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
				
			
				
																			
								admin 							 
						Site Admin 			
		Posts:  10443 		Joined:  Fri Sep 10, 2010 9:26 pm 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by admin   »  Thu Dec 13, 2018 10:16 pm 
			
			
			
			
			If you are a beginner, then it does take some time to figure it out, so, better to leave it for the end.
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
				
			
				
																			
								Nathan777 							 
									
		Posts:  2 		Joined:  Tue Oct 01, 2019 4:10 pm 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by Nathan777   »  Thu Jan 16, 2020 11:02 pm 
			
			
			
			
			I got pretty much this exact question with just different variable names on the exam today.  Luckily, I just had it right before when I was taking this test at Panera Bread down the road from the testing center.
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
	 
				
		
				
			
				
																			
								admin 							 
						Site Admin 			
		Posts:  10443 		Joined:  Fri Sep 10, 2010 9:26 pm 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by admin   »  Sun Jan 23, 2022 10:55 pm 
			
			
			
			
			Good link. thanks for sharing.
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
				
			
				
																			
								SCOTTBART1 							 
									
		Posts:  1 		Joined:  Fri Jan 13, 2023 4:49 pm 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by SCOTTBART1   »  Fri Jan 13, 2023 5:44 pm 
			
			
			
			
			Obtuse and deliberately muddy questions, don't see the point, nobody codes like that.
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
				
			
				
																			
								admin 							 
						Site Admin 			
		Posts:  10443 		Joined:  Fri Sep 10, 2010 9:26 pm 		
		
						
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by admin   »  Sat Jan 14, 2023 4:04 am 
			
			
			
			
			It true that nobody codes like that but the exam does test your ability to parse through such code.
			
			
									
									
						 
		 
				
		
		 
	 
	 
	
	
	
		
		Users browsing this forum: No registered users and 9 guests