This study focuses on developing an adaptive assessment system for basic programming courses using a combination of item response theory (IRT) and the K-mean. The main objective is to enhance the precision of assessments by adapting the difficulty of questions to students' cognitive levels while grouping them based on both cognitive and affective characteristics. The key contribution is the creation of a more personalized assessment framework, addressing the shortcomings of traditional assessments, which often fail to accommodate varying student abilities. Methodologically, the study employs IRT to dynamically assess students' abilities, and students are categorized into different groups based on their answer patterns using K-means. The research design involves a student motivation survey and a programming skills test. Data is collected through the Google Quiz platform and analyzed using R Studio Software to apply the algorithms. The results demonstrate that combining IRT and K-means successfully adjusts the difficulty of questions and more accurately clusters students, providing more relevant feedback. In conclusion, this method enhances adaptive assessments' effectiveness and fosters personalized learning experiences. The findings have implications for broader application in courses with diverse student competencies.