The main consensus in most compsci programs I have been at is that a sizable amount of students is inherently unable to learn how to code. An old entry on Jeff Atwood's blog summarizing the issue cites this 2006 article by Saeed Dehnadi and Richard Bornat, claiming:
Formal logical proofs, and therefore programs – formal logical proofs that particular computations are possible, expressed in a formal system called a programming language – are utterly meaningless. To write a computer program you have to come to terms with this, to accept that whatever you might want the program to mean, the machine will blindly follow its meaningless rules and come to some meaningless conclusion. In the test the consistent group showed a pre-acceptance of this fact: they are capable of seeing mathematical calculation problems in terms of rules, and can follow those rules wheresoever they may lead. The inconsistent group, on the other hand, looks for meaning where it is not. The blank group knows that it is looking at meaninglessness, and refuses to deal with it.
It even goes on as to propose some of the prospective students to be advised away from compsci courses:
There is a test for programming aptitude, or at least for success in a first programming course. We have speculated on the reasons for its success, but in truth we don’t understand how it works any more than you do.
Today, I found a retraction from Richard Bonat, claiming his conclusions were affected by his mental health issues:
2 How it happened
Though it’s embarrassing, I feel it’s necessary to explain how and why I came to write “The camel has two humps” and its part-retraction in (Bornat et al., 2008). It’s in part a mental health story.
In autumn 2005 I became clinically depressed. My physician put me on the then-standard treatment for depression, an SSRI. But she wasn’t aware that for some people an SSRI doesn’t gently treat depression, it puts them on the ceiling. I took the SSRI for three months, by which time I was grandiose, extremely self-righteous and very combative – myself turned up to one hundred and eleven. I did a number of very silly things whilst on the SSRI and some more in the immediate aftermath, amongst them writing “The camel has two humps”. I’m fairly sure that I believed, at the time, that there were people who couldn’t learn to program and that Dehnadi had proved it. The paper doesn’t exactly make that claim, but it comes pretty close. Perhaps I wanted to believe it because it would explain why I’d so often failed to teach them. It was an absurd claim because I didn’t have the extraordinary evidence needed to support it. I no longer believe it’s true.
I've been a TA for compsci courses in three colleges and, in all of them, transparency was a core value: past exams, classes, and grades were made available from the very beginning. Failure rates were never lower than 30%, often beating failure rates for subjects widely regarded as more difficult, such as physics or calculus.
On the one hand, some students might feel discouraged to put in the effort to learn knowing that they have a high likelihood of failing. On the other hand, it might be beneficial for them to know hiccups are expected and perhaps compsci might not be the way for them.
My questions are: do students benefit from knowing most of them will likely fail the subject? Should they be informed that there might be a high chance they won't advance past CS101?