Got solution to this problem by trying different queries.
MATCH (s:Student {id :1})
OPTIONAL MATCH (s)-[:ATTENDS]->(c:Class)
RETURN s.id AS student_id , s.name as student_name, c.name as class_name
Need to first match required criteria and then optional match. If anyone have simpler solution then please post.