You asked

Pentax hd da 40mm f 2 8 limited vs pentax smc da 35mm f 2 4 al?

Here is what the site says about that.

From Pentax smc DA 35mm f/2.4 AL: Pentax smc DA 35mm f/2.4 AL: A prime lens by Pentax for APS-C cameras, 35mm f/2.4. Specs - Maker: Pentax - Focal length: 35mm (prime) - Maximum aperture: f/2.4 - Made for: APS-C sensors - Mounts: Pentax K - Stabilised: no - Autofocus: yes What it frames like - On APS-C (Pentax K): like 52mm on full frame; f/2.4 gives about the depth of field of f/3.6 there. - On the larger-sensor bodies of Pentax K: ...

From Pentax HD DA 40mm f/2.8 Limited: Pentax HD DA 40mm f/2.8 Limited: A prime lens by Pentax for APS-C cameras, 40mm f/2.8. A pancake lens that keeps the camera small. Specs - Maker: Pentax - Focal length: 40mm (prime) - Maximum aperture: f/2.8 - Made for: APS-C sensors - Mounts: Pentax K - Stabilised: no - Autofocus: yes What it frames like - On APS-C (Pentax K): like 60mm on full frame; f/2.8 gives about the depth of field of f/4.2 there. ...

Quoted from this site's pages.

From these pages

This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.