Is God perfect? Can he be a god if He is not?

Reading the thread on the Holy Tinity reminded me of when I was studying part of Milton's Paradise Lost and I was fascinated by a question put to the class by the teacher.

First, she spoke of the concept of Free Will and how God allowed all beings He created the freedom to do as they wished, even if that was evil or led to failure. Thus, when Satan rebelled, he did so because he was using his free will to choose whether to rule in Hell or serve in Paradise. And when Eve was persuaded by the snake to eat the forbidden fruit, she knew she had been told not to, but did so all the same; she used her free will.

Why did God place the tree in the middle of the Garden of Eden, yet forbid Adam and Eve to eat from it? That's easy, we thought. God wanted to test them. He wanted to see if His new creations could exercise their free will judiciously.

But was it a test? Or was it a trap that Adam and Eve were destined to fail?

First, if God could see into the future, which I am told He can, then He would have seen that they would fail the test. But maybe He could only see outcomes of things that were inevitable or which had already been set in motion - so maybe He did still need to carry out the test.

In that case, did He intend them to fail the test. He knew that the temptation would be too great to resist and, sooner or later, the desire to taste the fruit would be greater than their obedience to Him. Well, if that's the case, God would have deceived Adam and Eve into believing they were perfect creations that were allowed to make their own decisions whatever the consequences. If they were doomed to fail, then they did not really have free will. Deception is not what we would expect of a good God, is it?

The fact that God needed to test them is curious. After all, they were His perfect creations. If they were perfect creations, they would never be able to decide to do wrong or to do evil, despite having free will. But they did decide to disobey. Therefore, they could not have been perfect creations, but flawed in some way. The test, then, was just an excuse to punish. (Where have I heard this before, I can here some subs muttering.)

But this leads to the big question. If God is perfect, He is incapable of imperfection. Perfect means without any faults whatsoever. A perfect God cannot create imperfect beings. Thus He was unable to create Adam and Eve with flaws or imperfections. But as they were flawed or imperfect, it must mean that God Himself is less than perfect too.

Going further, He created Satan. If Satan was perfect, why did he rebel? Surely that was not possible either?

I've not had a religious education, and my RE lessons consisted of a Cook's Tour of Roman Occupied Palestine. There was no discussion of concepts such as this. However, this question has remained with me ever since. I'm also not a particularly deep thinking person, so I have been unable to develop these thoughts on my own. I wonder if anyone here has anything they can contribute on the topic.

TYWD