Yes, you can go as undecided for 1 - 2 years and take general electives.
I would really recommend that you or a adviser go through a curriculum and pick “general electives” that will count toward your degree.
Don’t just pick classes because you “might like them and might want to learn something”. Make sure EVERY one counts. Shit takes way too much time and is way too expensive to fuck around. Trust me on that one.