The courses of freshmen and sophomores in community colleges are basically the same as those in four-year universities, and the credits taken can also be transferred to undergraduate courses.
You don't need a high school diploma to apply for a community college, but you still need to provide it when you enter school, so even if you don't go to school, you still have to take the graduation exam.