We present comprehensive experimental and numerical studies of the subpicosecond switching dynamics of YBa2Cu3O7-x (YBCO) grain-boundary Josephson junctions, excited by single-picosecond electrical pulses. The test structures were patterned in 100-nm- thick YBCO films grown by pulsed laser deposition on (100) MgO bicrystal substrates. Each sample consisted of a coplanar strip (CPS) transmission line, a microbridge acting as the electrical pulse generator, and a single Josephson junction positioned between the CPS lines about 100 micrometer away from the bridge. The junctions were characterized by the nonhysteretic current-voltage characteristics with the characteristic voltage approximately equal to 2.0 mV at 20 K (temperature of our experiments). A train of 100- fs-wide optical pulses from a Ti:sapphire laser photo-excited the microbridge and generated 2-ps-wide electrical pulses, which were then applied to switch the junction. In addition to the input pulse, the junction was dc-biased at +0.7 Ic, -0.7 Ic, +1.5 Ic, -1.5 Ic, and zero-Ic, where Ic is junction critical current. Time-resolved dynamics of the junction response was studied with the help of our cryogenic electro-optic sampling system, which can be regarded as a sampling oscilloscope featuring < 200-fs time resolution and < 150-(mu) V voltage sensitivity. We obtained 0.7-ps-wide single-flux-quantum (SFQ) pulses generated as a result of the junction switching process. The measurements were compared to numerical computations based on the equivalent circuit containing a resistively shunted Josephson junction, and we have found a satisfactory agreement between our simulations and experimental data. We believe our findings provide experimental confirmation of the potential of YBCO Josephson gattes as building blocks of ultrafast (sub-THz) digital electronics.