Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a program to calculate the dot product of two vectors.

Medium

Problem Statement

Write a program to calculate the dot product of two vectors.

Sample Input

Vector 1: c(1, 2, 3)
Vector 2: c(4, 5, 6)

Sample Output

Dot Product: 32

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
# Predefined structure vector1 <- # Define the first vector vector2 <- # Define the second vector dot_product <- # Calculate the dot product print(paste("Dot Product:", dot_product))
Log in or sign up to run or submit your code.Log inSign up
Input
Vector 1: c(1, 2, 3)
Vector 2: c(4, 5, 6)
Expected Output
Dot Product: 32