Write SQL query to solve given problem: How many students, who have a GPA between 3 to 4, failed a course?. Keep the solution inside sql tag ```sql [SQL-Query] ```
SELECT COUNT(T2.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T2.grade IS NULL AND T1.gpa BETWEEN 3 AND 4