Skip to content

[week6_NAEUN] 6주차 퀴즈 출제#14

Open
eunkr82 wants to merge 2 commits intomainfrom
week6_NAEUN
Open

[week6_NAEUN] 6주차 퀴즈 출제#14
eunkr82 wants to merge 2 commits intomainfrom
week6_NAEUN

Conversation

@eunkr82
Copy link
Collaborator

@eunkr82 eunkr82 commented Dec 2, 2025

Q1.

다음 설명이 옳으면 O, 틀리면 X를 고르시오.

  1. new Promise(...)로 생성된 Promise의 초기 상태는 pending이다.
  2. 한 Promise에서 resolvereject가 둘 다 호출되면, 나중에 호출된 쪽이 실제 최종 상태를 결정한다.
  3. promise.then(...)을 호출하면 항상 새로운 Promise 객체가 반환된다.
  4. then의 콜백에서 값을 그냥 반환하면, 그 값은 다음 then으로 전달되지 않는다. (즉, 단순 반환은 무시된다.)

Q2.

다음 코드의 실행 결과(콘솔 출력 순서)를 쓰시오.

console.log('A');

setTimeout(() => {
  console.log('B');
}, 0);

Promise.resolve()
  .then(() => {
    console.log('C');
  });

console.log('D');

Q3.

async function getData() {
  const response = await fetch('/api/data');
  const data = await response.json();
  return data;
}

async function main() {
  try {
    const result = await getData();
    console.log('성공:', result);
  } catch (error) {
    console.error('에러 발생:', error);
  }
}

main();

아래 보기 중, catch 블록이 실행되는 상황을 모두 고르시오.

  1. 서버가 200 OK로 응답했지만, JSON이 아니라 이상한 텍스트를 보내서 response.json() 하는 순간 파싱 에러가 난 경우

  2. 서버가 404 Not Found로 응답한 경우

  3. 사용자의 인터넷이 끊겨서 아예 요청을 보내지 못한 경우 (네트워크 에러)

@eunkr82 eunkr82 changed the title Week6 naeun [week6_NAEUN] 6주차 퀴즈 출제 Dec 2, 2025
@eunkr82 eunkr82 self-assigned this Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant