0
0
LangChainframework~20 mins

LangChain Expression Language (LCEL) basics - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
LCEL Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
1:30remaining
What is the output of this LCEL expression?
Given the LCEL expression "Hello, {user.name}! Today is {date.today()}", what will be the output if user.name is "Alice" and today's date is 2024-06-15?
A"Hello, {user.name}! Today is {date.today()}"
B"Hello, Alice! Today is 2024-06-15"
C"Hello, Alice! Today is {date.today()}"
D"Hello, user.name! Today is 2024-06-15"
Attempts:
2 left
💡 Hint
LCEL replaces expressions inside curly braces with their evaluated values.
📝 Syntax
intermediate
1:30remaining
Which LCEL expression is syntactically correct?
Choose the LCEL expression that is valid and will not cause a syntax error.
A"Sum is {a + b}"
B"Sum is a + b}"
C"Sum is {a + b"
D"Sum is {a + }"
Attempts:
2 left
💡 Hint
Check for balanced braces and complete expressions inside curly braces.
state_output
advanced
2:00remaining
What is the value of variable result after evaluating this LCEL expression?
Given variables a = 5 and b = 3, what is the value of result after evaluating "{a > b ? 'a is greater' : 'b is greater or equal'}"?
A"a is greater"
B"b is greater or equal"
Ctrue
Dfalse
Attempts:
2 left
💡 Hint
LCEL supports ternary expressions inside curly braces.
🔧 Debug
advanced
2:00remaining
Which option causes a runtime error when evaluating this LCEL expression?
Consider the LCEL expression "User age: {user.age}". Which option will cause a runtime error if user does not have an age property?
A"User age: {user.age ?? 'unknown'}"
B"User age: {user?.age}"
C"User age: {user.age}"
D"User age: {user.get('age', 'unknown')}"
Attempts:
2 left
💡 Hint
Check how missing properties are accessed safely in LCEL.
🧠 Conceptual
expert
2:30remaining
How many items are in the resulting list after evaluating this LCEL expression?
Given numbers = [1, 2, 3, 4], what is the length of the list produced by [n * 2 for n in numbers if n % 2 == 0] in LCEL?
A1
B4
C3
D2
Attempts:
2 left
💡 Hint
Filter numbers that are even, then multiply by 2.