Weird midterm results


I've graded many tests from 2025. Here are the most hilarious results from C programming midterms.

2025. first midterm


Make sure to check if an int is NULL:


int i=0;
if(++i != null){
	...;
}
					

Absolute cinema:


if(bool = true){
	...;
}
					

just make sure to find that null terminator in that happy number check:


bool is_happy_number(int* ptr){
	while(*ptr != '\0'){
		...;
	}
}
					

The most useful ternary operator:


bool func(...){
	...;
	return p==1 ? true:false;
}
					

Saying symbols out loud in Hungarian:


include kacsacsőr stdio.h kacsacsőr
...;
					

strlen(int):


bool sum(int num){
	int digits = strlen(num);
	...;
}
					

A brilliant search algorithm which is O(1):


int find(int number){
	return number;
}
					

Return more! Not just once!:


...;
for(int i=0;i<10;i++){
	return;
}
					

The hell is this???:


int b=...;
b = b%;
					

A squared sum returning a boolean:


bool sqr_sum(int a);
					

You need that break really, do you?:


for(...){
	if(condition){
		return;
		break;
	}
}
					

No params and no output:


void is_prime(void);
					

I am pretty sure you don't check primes like this:


bool is_prime(int num){
	if(num%2 ==0){
		return true;
	}
	return false;
}
					

A guy had multiple mains??? For some reason, a void too:


int main(void){
	...;
}
...
int main(void){
	...;
}
...
void main(void){
	...;
}
...

					

Always check the int for a null terminator:


bool func(int num){
	if(num[0] =='\0'){
		return false;
	}
	...;
}
					

What the hell do you need that for:


int sum_of_number_digits(int * i[]){
	int sum = 0;
	for(int j=0;j

Make sure to poll the value of the EOF:


...;
while(!EOF){
	fgets(x,6,stdin);
	...;
}
...;
					

This scanf is a new millenium problem:


...;
scanf("%&0[EOF]",var);
...;
					


Go back to main page