wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
UPDATE orders SET email='test' WHERE role=49 | UPDATE orders SET email='test' WHERE role=49; | Add semicolon. | SQL |
List(52,97,90) | List(52,97,90) | Correct. | Scala |
#content {{ color: green; }} | #content {{ color: green; }} | Correct. | CSS |
x := 45 | x := 45 | Correct. | Go |
while read line; do echo $line; done < config.json | while read line; do echo $line; done < config.json | Correct. | Shell |
val count = 'value' | val count = "value" | Double quotes. | Kotlin |
let foo: number | null = null; foo.toFixed(49); | let foo: number | null = null; if(foo!==null) foo.toFixed(49); | Null check. | TypeScript |
let temp: number = 'result'; | let temp: string = 'result'; | Fix type. | TypeScript |
print('message') | print('message') | Correct. | R |
WHERE id = '61' | WHERE id = 61 | Don't quote integer. | SQL |
if item = 35 {{}} | if item == 35 {{}} | Use ==. | Swift |
function render(num)
print(num)
end | function render(num)
print(num)
end | Correct. | Lua |
match item {{ 1 => {{}} }} | match item {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
items(53) | if length(items) >= 53, items(53), end | Check length. | MATLAB |
<ul><li>test<li>test</ul> | <ul><li>test</li><li>test</li></ul> | Close li. | HTML |
json.sqrt(67) | import json
json.sqrt(67) | Import module first. | Python |
let val: i32 = "world"; | let val: &str = "world"; | Type mismatch. | Rust |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
if item > 25
puts 'value' | if item > 25
puts 'value'
end | Add 'end'. | Ruby |
fn process() -> i32 {{ 6 }} | fn process() -> i32 {{ 6 }} | Correct. | Rust |
User.save(); | User.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
List<int> list = [1,2,3]; | List<int> list = [1,2,3]; | Correct. | Dart |
print 'hello' | print('hello') | Parentheses for function call. | Lua |
if (a = 74) {{}} | if (a == 74) {{}} | Use ==. | Java |
echo 'output' | echo 'output'; | Add semicolon. | PHP |
SELECT age status FROM items; | SELECT age, status FROM items; | Add comma. | SQL |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
process | process() | Add parentheses. | Kotlin |
<person age=93> | <person age="93"> | Quote attribute. | XML |
<div color=#333> | <div style='color:#333;'> | Use style attribute. | CSS |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
let val = 42; let val = 2; | let val = 42; val = 2; | Duplicate declaration. | JavaScript |
cin >> b; | int b;
cin >> b; | Declare variable. | C++ |
for item in range(85)
print(item) | for item in range(85):
print(item) | Colon after for. | Python |
{{"age":"world" "age":66}} | {{"age":"world", "age":66}} | Add comma. | JSON |
<img src='data.jpg'> | <img src='data.jpg' alt='desc'> | Add alt text. | HTML |
function compute(b:string){{return b;}} compute(67); | function compute(b:string){{return b;}} compute('message'); | Pass correct type. | TypeScript |
if (x = 73) {{}} | if (x === 73) {{}} | Use === for equality. | JavaScript |
$data[74] = 5; | if (isset($data[74])) $data[74] = 5; | Check existence. | PHP |
<table><tr><td>world<td>hello</tr></table> | <table><tr><td>world</td><td>hello</td></tr></table> | Close td. | HTML |
if ($count = 37) {{}} | if ($count -eq 37) {{}} | Use -eq. | PowerShell |
num = value | num = 'value' | Quote strings. | Python |
if (count = 61) {{}} | if (count == 61) {{}} | Use ==. | Kotlin |
c == '45' | c === 45 | Use strict equality. | JavaScript |
int[] arr = new int[77];
arr[77] = 5; | int[] arr = new int[77];
if (77 < arr.length) arr[77] = 5; | Check bounds. | Java |
if (b = 58) {} | if (b == 58) {} | Use ==. | Dart |
DELETE FROM products WHERE email=39 | DELETE FROM products WHERE email=39; | Add semicolon. | SQL |
<p>output <b>hello</p></b> | <p>output <b>hello</b></p> | Nest properly. | HTML |
Write-Host 'result' | Write-Host 'result' | Correct. | PowerShell |
if [ $index = 8 ]; then | if [ "$index" = 8 ]; then | Quote variable. | Shell |
'hello' + 76 | 'hello' + str(76) | Can't add int to string. | Python |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
switch(z){{ case 98: break; }} | switch(z){{ case 98: break; default: break; }} | Add default case. | Java |
def render
puts 'hello'
end | def render
puts 'hello'
end | Correct. | Ruby |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
if (foo) console.log('yes') else console.log('no') | if (foo) console.log('yes'); else console.log('no'); | Missing semicolon. | JavaScript |
if count = 88 | if count == 88 | Use ==. | Go |
$values[72] | if ($values.Count -gt 72) {{ $values[72] }} | Check bounds. | PowerShell |
println('data') | println("data") | Double quotes. | Scala |
<br></br> | <br> | Self-closing. | HTML |
print 'data' | print 'data'; | Add semicolon. | Perl |
var x = 5; x = "hello" | var x = "hello" | Type mismatch. | Swift |
SELECT COUNT(*) FROM orders | SELECT COUNT(*) FROM orders; | Missing semicolon. | SQL |
else
print('data') | else:
print('data') | Colon after else. | Python |
$x = 5; print $x | $x = 5; print $x; | Missing semicolon. | Perl |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
class Child Entity: | class Child(Entity): | Inheritance uses parentheses. | Python |
try {{ throw 'value'; }} catch(e) {{}} | try {{ throw new Error('value'); }} catch(e) {{}} | Throw Error objects. | JavaScript |
<input type='text' value='world'> | <input type='text' value='world' name='name'> | Add name attribute. | HTML |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
x = 5; if x > 3, disp('large'), end | x = 5; if x > 3, disp('large'), end | Correct. | MATLAB |
items[69] | if (items.indices.contains(69)) items[69] | Check index. | Kotlin |
INSERT INTO users VALUES ('value',67) | INSERT INTO users (id, status) VALUES ('value',67); | Specify columns. | SQL |
if c = 71 then
print('info')
end | if c == 71 then
print('info')
end | Use ==. | Lua |
JOIN products ON users.id = products.id | JOIN products ON users.id = products.id | Correct. | SQL |
const c = 45; c = 5; | let c = 45; c = 5; | Cannot reassign const. | JavaScript |
<note name='hello'/> | <note name="hello"/> | Double quotes. | XML |
name: data
age: 16 | name: data
age: 16 | Correct. | YAML |
$a = 91; if ($a = 91) {{}} | $a = 91; if ($a == 91) {{}} | Use ==. | PHP |
int x; System.out.println(x); | int x = 0; System.out.println(x); | Initialize variable. | Java |
jwt.sign({{id:6}}, 'token'); | jwt.sign({{id:6}}, 'token', {{expiresIn:'30m'}}); | Add expiration. | Node.js |
System.out.println('result') | System.out.println('result'); | Add semicolon. | Java |
fmt.Println 'data' | fmt.Println('data') | Missing parentheses. | Go |
let index: Int = 'data' | let index: String = 'data' | Fix type. | Swift |
let item = 77; item += 1; | let mut item = 77; item += 1; | Need mut to modify. | Rust |
const user:Person = {{name:'data'}}; | const user:Person = {{name:'data', age:79}}; | Add missing property. | TypeScript |
with open('config.json') as file_handle:
data = file_handle.read() | with open('config.json') as file_handle:
data = file_handle.read() | Correct. | Python |
yield x | yield x | Correct yield. | Python |
h1 {{ font-size:95px color:#333; }} | h1 {{ font-size:95px; color:#333; }} | Add semicolon. | CSS |
let result = 97; | let result = 97; | Correct. | JavaScript |
raise 'test' | raise Exception('test') | Raise needs an exception class. | Python |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('world')); app.listen(95); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('world')); app.listen(95, () => console.log('listening')); | Add callback. | Node.js |
{{'id':74, 'name' 59}} | {{'id':74, 'name':59}} | Colon missing. | Python |
for i=1,56 do print(i) end | for i=1,56 do print(i) end | Correct. | Lua |
def render():
print('result') | def render():
print('result') | Indent function body. | Python |
if ($a = 96) | if ($a == 96) | Use ==. | Perl |
if (bar = 61) | if (bar == 61) | Use ==. | Scala |
assert y > 41 | assert y > 41 | Correct. | Python |
[x*x for x in arr if x > 90] | [x*x for x in arr if x > 90] | Correct list comprehension. | Python |
class = 'output' | class_name = 'output' | 'class' is a keyword. | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.