Strings: AP CSP practice
Slicing, length, case and characters. 3 questions in the style of the AP CSP exam.
Sample questions
In this question, SUBSTRING(str, start, len) returns len characters of str beginning at position start (the first character is at position 1), and CONCAT(s1, s2) joins two strings together. What is displayed? In AP pseudocode, DISPLAY shows a value followed by a space, so type every displayed value on one line, separated by single spaces.
word ← "COMPUTER" part ← SUBSTRING(word, 4, 3) DISPLAY(CONCAT(part, "S"))