가장 많이 묻는 면접 질문과 답변 & 온라인 테스트
면접 준비, 온라인 테스트, 튜토리얼, 라이브 연습을 위한 학습 플랫폼

집중 학습 경로, 모의고사, 면접 준비 콘텐츠로 실력을 키우세요.

WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.

Prepare Interview

모의 시험

홈페이지로 설정

이 페이지 북마크

이메일 주소 구독
/ 면접 주제 / Python Coding
WithoutBook LIVE Mock Interviews Python Coding Related interview subjects: 9

Interview Questions and Answers

Know the top Python Coding interview questions and answers for freshers and experienced candidates to prepare for job interviews.

Total 20 questions Interview Questions and Answers

The Best LIVE Mock Interview - You should go through before interview

Know the top Python Coding interview questions and answers for freshers and experienced candidates to prepare for job interviews.

Interview Questions and Answers

Search a question to view the answer.

Freshers / Beginner level questions & answers

Ques 3

Write a Python function to check if a given year is a leap year.

def is_leap_year(year):

return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)

Example:

is_leap_year(2024)  # Output: True
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 5

Write a Python program to count the occurrences of each element in a list.

from collections import Counter

def count_occurrences(lst):

  return Counter(lst)

Example:

count_occurrences([1, 2, 1, 3, 2, 4, 1])  # Output: {1: 3, 2: 2, 3: 1, 4: 1}
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 6

Create a function to check if a given string is an anagram of another string.

def is_anagram(str1, str2):

  return sorted(str1) == sorted(str2)

Example:

is_anagram(\'listen\', \'silent\')  # Output: True
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 7

Implement a function to remove duplicates from a list.

def remove_duplicates(lst):

  return list(set(lst))

Example:

remove_duplicates([1, 2, 2, 3, 4, 4, 5])  # Output: [1, 2, 3, 4, 5]
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments

Intermediate / 1 to 5 years experienced level questions & answers

Ques 9

Implement a function to check if a number is prime.

def is_prime(num):

  if num < 2:

  return False

  for i in range(2, int(num**0.5) + 1):

    if num % i == 0:

      return False

   return True

Example:

is_prime(11)  # Output: True
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 10

Create a Python class for a basic stack implementation.

class Stack:

  def __init__(self):

    self.items = []

 

  def push(self, item):

    self.items.append(item)

 

  def pop(self):

    return self.items.pop()

 

  def is_empty(self):

    return len(self.items) == 0

Example:

stack = Stack()
stack.push(1)
stack.push(2)
print(stack.pop())  # Output: 2
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 11

Write a Python program to find the nth Fibonacci number.

def fibonacci(n):

  if n <= 1:

    return n

  else:

    return fibonacci(n-1) + fibonacci(n-2)

Example:

fibonacci(5)  # Output: 5
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 12

Write a Python program to find the length of the longest increasing subsequence in an array.

def longest_increasing_subsequence(arr):

  n = len(arr)\n lis = [1]*n

  for i in range(1, n):

    for j in range(0, i):

      if arr[i] > arr[j] and lis[i] < lis[j] + 1:

        lis[i] = lis[j] + 1

          return max(lis)

Example:

longest_increasing_subsequence([10, 22, 9, 33, 21, 50, 41, 60, 80])  # Output: 6
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 13

Create a Python generator function to generate the power set of a given set.

def power_set(input_set):

  n = len(input_set)

  for i in range(1 << n):

    subset = [input_set[j]

      for j in range(n):

        if (i & (1 << j)) > 0]

          yield subset

Example:

power_set({1, 2, 3})  # Output: [], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 14

Write a Python function to implement the binary search algorithm.

def binary_search(arr, target):

  low, high = 0, len(arr) - 1

  while low <= high:

    mid = (low + high) // 2

    if arr[mid] == target:

      return mid

    elif arr[mid] < target:

      low = mid + 1

    else:

      high = mid - 1

    return -1

Example:

binary_search([1, 2, 3, 4, 5, 6, 7], 4)  # Output: 3
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments

Experienced / Expert level questions & answers

Ques 15

Implement a function to find the intersection of two lists.

def intersection(list1, list2):

  return list(set(list1) & set(list2))

Example:

intersection([1, 2, 3], [2, 3, 4])  # Output: [2, 3]
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 16

Write a Python program to perform matrix multiplication.

import numpy as np

matrix1 = np.array([[1, 2], [3, 4]])

matrix2 = np.array([[5, 6], [7, 8]])

result = np.dot(matrix1, matrix2)

Example:

print(result)
# Output: [[19, 22], [43, 50]]
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 17

Create a generator function to generate Fibonacci numbers.

def fibonacci_generator():

  a, b = 0, 1

  while True:

    yield a

    a, b = b, a + b

Example:

fib_gen = fibonacci_generator()
print(next(fib_gen))  # Output: 0
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 18

Implement a depth-first search (DFS) algorithm for a graph.

def dfs(graph, node, visited):

  if node not in visited:

    print(node)

    visited.add(node)

    for neighbor in graph[node]:

      dfs(graph, neighbor, visited)

Example:

graph = {1: [2, 3], 2: [4, 5], 3: [6], 4: [], 5: [], 6: []}
visited_set = set()
dfs(graph, 1, visited_set)
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 19

Implement a function to check if a binary tree is balanced.

class TreeNode:
 def __init__(self, value):
 self.value = value
 self.left = None
 self.right = None


def is_balanced(root):
 if root is None:
 return True
 left_height = height(root.left)
 right_height = height(root.right)
 return abs(left_height - right_height) <= 1 and is_balanced(root.left) and is_balanced(root.right)


def height(node):
 if node is None:
 return 0
 return max(height(node.left), height(node.right)) + 1

Example:

# Example usage: Check if 'root' is a balanced binary tree
is_balanced(root)
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments
Ques 20

Write a Python program to implement a simple LRU (Least Recently Used) cache.

from collections import OrderedDict

class LRUCache:
 def __init__(self, capacity):
 self.cache = OrderedDict()
 self.capacity = capacity

 def get(self, key):
 if key in self.cache:
 self.cache.move_to_end(key)
 return self.cache[key]
 return -1

 def put(self, key, value):
 if len(self.cache) >= self.capacity:
 self.cache.popitem(last=False)
 self.cache[key] = value
 self.cache.move_to_end(key)

Example:

# Example usage:
lru_cache = LRUCache(3)
lru_cache.put(1, 1)
lru_cache.put(2, 2)
lru_cache.put(3, 3)
print(lru_cache.get(2))  # Output: 2
복습용 저장

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요?
Add Comment View Comments

Most helpful rated by users:

Copyright © 2026, WithoutBook.