if there are 40 question and each question carrying 5 marks and each wrong attempt can deduct 3 marks. if someone secured 70 marks then how many question he has attempted

Poorly worded question.

Are we to assume that some questions were skipped, and no reward or penalty for skipped questions?
I will assume that.

rights ---- x
wrongs --- y
skipped -- 40-x-y)

5x - 3y + 0(40-x-y) = 70
5x - 3y = 72
y = (5x-70)/3 , clearly 14 ≤ x ≤ 40 , x+y ≤ 40
values of x that yield whole number values for y are:
x .... y
14 0
17 5
20 10
23 15
26 20 ----> not possible notice 26+20 > 40

possible number of questions attempted:
14 , 22, 36, or 38

checking one of them:
20, 10
number correct: 20
number wrong : 10
number attempted: 36
marks obtained = 20(5) - 6(10) = 70