This one should be quite simple. Find and explain the bug in each of the following code snippets:
1.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
2.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
3.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
4.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			1.
			
				B4X:
			
		
		
		'main
Sub Process_Globals
End Sub
Sub Globals
   Dim sql1 As SQL
End Sub
Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
     sql1.Initialize(File.DirRootExternal, "1.db", False)
   End If
End Sub
	2.
			
				B4X:
			
		
		
		'main
Sub Process_Globals
   Public sql1 As SQL
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
     sql1.Initialize(File.DirRootExternal, "1.db", False)
   End If
   StartServiceAt(Service1, DateTime.Now + 1 * DateTime.TicksPerHour, True)
End Sub
'Service1
Sub Service_Create
Log(Main.sql1.ExecQuerySingleResult("SELECT Count(*) From Table1"))
End Sub
	3.
			
				B4X:
			
		
		
		Sub Process_Globals
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
     Activity.LoadLayout("Layout1")
   End If
End Sub
	4.
			
				B4X:
			
		
		
		Sub Activity_Pause (UserClosed As Boolean)
   If Msgbox("Do you want to save changes?", "") = DialogResponse.POSITIVE Then
     SaveChanges
   End If
End Sub